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

1.7.0 • Public • Published

file-fetch

file-fetch is a nodeify-fetch compatible fetch for read and write access to the local file system using file:// URLs (including implicit ones using relative paths).

Usage

Only the URL is required to read a file:

const fileFetch = require('file-fetch')

fileFetch('file://etc/hosts').then((res) => {
  res.body.pipe(stdout)
})

To write files the method PUT must be used and readable stream must be given as body:

fileFetch('file://tmp/example.log', {
  method: 'PUT',
  body: stream
})

Install

npm i file-fetch

DownloadsWeekly Downloads

364

Version

1.7.0

License

MIT

Unpacked Size

18.3 kB

Total Files

8

Last publish

Collaborators

  • bergos