proto-fetch
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/proto-fetch package

2.0.0 • Public • Published

proto-fetch

build status npm version

A protocol handler wrapper for fetch.

Usage

proto-fetch doesn't contain any fetch implementations. A map of protocol to implementation must be given to the constructor. This example shows how to create a fetch for file, http and https URLs:

import fileFetch from 'file-fetch'
import httpFetch from 'nodeify-fetch'
import protoFetch from 'proto-fetch'

const fetch = protoFetch({
  [null]: fileFetch,
  file: fileFetch,
  http: httpFetch,
  https: httpFetch
})

const res = await fetch(`file://${process.cwd()}/package.json`)

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.0.0
    5,481
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 2.0.0
    5,481
  • 1.0.0
    3,605

Package Sidebar

Install

npm i proto-fetch

Weekly Downloads

9,086

Version

2.0.0

License

MIT

Unpacked Size

6.54 kB

Total Files

7

Last publish

Collaborators

  • bergos