Skip to content

bergos/proto-fetch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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`)

About

Protocol handler wrapper for fetch

Resources

License

Stars

Watchers

Forks

Packages

No packages published