get-uri

  • Version 4.0.0
  • Published
  • 44.7 kB
  • 6 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

variable protocols

const protocols: { [key: string]: GetUriProtocol };

    Functions

    function getUri

    getUri: typeof getUri;
    • Async function that returns a stream.Readable instance to the callback function that will output the contents of the given URI.

      For caching purposes, you can pass in a stream instance from a previous getUri() call as a cache: 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 with code set to "ENOTMODIFIED" and null 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

      Parameter fn

      callback function public

    Interfaces

    interface GetUriOptions

    interface GetUriOptions {}

      property cache

      cache?: Readable;

        Type Aliases

        type GetUriCallback

        type GetUriCallback = (err?: Error | null, res?: Readable) => void;

          type GetUriProtocol

          type GetUriProtocol = (
          parsed: UrlWithStringQuery,
          opts: getUri.GetUriOptions
          ) => Promise<Readable>;

            Package Files (1)

            Dependencies (6)

            Dev Dependencies (10)

            Peer Dependencies (0)

            No peer dependencies.

            Badge

            To add a badge like this onejsDocs.io badgeto 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>