A nodeify-fetch compatible fetch implementation for reading and writing to the local file system using file: URLs and URIs, including implicit relative paths. v2.0.1 (stable, low release cadence). Supports GET for reading content as stream, text, or JSON, and PUT for writing from string or Readable stream. Key differentiators: supports file: URIs (not just absolute file:/// URLs), custom baseURL and contentType factory, and streaming body. No external dependencies beyond Node.js built-ins.
npm install file-fetchNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates reading a file as text, writing with PUT, and parsing JSON. Uses file: URLs and relative paths.
Use import statements or dynamic import() instead of require().
Always use file:/// prefix for absolute paths. Example: file:///home/user/file.txt
Check method: if method is PUT, do not attempt to read response body.
Use factory() if you need custom baseURL or contentType; for other customizations, consider a wrapper.
Ensure the URL or URI is a valid file: URL (file:///...), file: URI (file:path), or a relative path. For absolute URLs, must start with file:///.
Only read res.body for GET requests. For PUT, the response does not include a body.
Verify the file path exists. Use absolute URLs or relative paths with correct baseURL.