Skip to content
fetch for read and write access to the local file system
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test
.gitignore
.travis.yml
README.md
index.js
package.json

README.md

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
})
You can’t perform that action at this time.