get-uri
- Version 6.0.3
- Published
- 44.3 kB
- 4 dependencies
- MIT license
Install
npm i get-uri
yarn add get-uri
pnpm add get-uri
Overview
Returns a `stream.Readable` from a URI string
Index
Variables
Functions
Type Aliases
Variables
variable protocols
const protocols: { data: GetUriProtocol<import('./data').DataOptions>; file: GetUriProtocol<import('./file').FileOptions>; ftp: GetUriProtocol<import('./ftp').FTPOptions>; http: GetUriProtocol<import('./http').HttpOptions>; https: GetUriProtocol<import('./http').HttpOptions>;};
Functions
function getUri
getUri: <Uri extends string>( uri: Uri | URL, opts?: ProtocolOpts<Uri>) => Promise<Readable>;
Async function that returns a
stream.Readable
instance that will output the contents of the given URI.For caching purposes, you can pass in a
stream
instance from a previousgetUri()
call as acache: stream
option, and if the destination has not changed since the last time the endpoint was retreived then the callback will be invoked with an Error object withcode
set to "ENOTMODIFIED" andnull
for the "stream" instance argument. In this case, you can skip retreiving the file again and continue to use the previous payload.Parameter uri
URI to retrieve
Parameter opts
optional "options" object public
function isValidProtocol
isValidProtocol: (p: string) => p is 'data' | 'file' | 'ftp' | 'http' | 'https';
Type Aliases
type GetUriProtocol
type GetUriProtocol<T> = (parsed: URL, opts?: T) => Promise<Readable>;
type ProtocolOpts
type ProtocolOpts<T> = { [P in keyof ProtocolsOptions]: Protocol<T> extends P ? ProtocolsOptions[P] : never;}[keyof Protocols];
type Protocols
type Protocols = typeof protocols;
type ProtocolsOptions
type ProtocolsOptions = { [P in keyof Protocols]: NonNullable<Parameters<Protocols[P]>[1]>;};
Package Files (1)
Dependencies (4)
Dev Dependencies (12)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/get-uri
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/get-uri)
- HTML<a href="https://www.jsdocs.io/package/get-uri"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 2771 ms. - Missing or incorrect documentation? Open an issue for this package.