fetch-blob provides a robust implementation of the Web Blob and File APIs for Node.js environments, originally forked from `node-fetch`. It is currently at stable version 4.0.0, with frequent minor and patch releases, and major releases addressing breaking changes related to internal architecture or standard compliance. Key differentiators include its ability to handle Blob parts backed by the file system without loading content into memory, and its support for WHATWG streams, requiring explicit conversion for Node.js stream compatibility. While Node.js 18+ includes a native `Blob` class, `fetch-blob` remains relevant for older Node.js versions or for its advanced file system-backed blob capabilities.
npm install fetch-blobVerified import paths — ran on the pinned version, not inferred.
Demonstrates creating a Blob from text, a File from a file path using `fileFromSync`, combining them into a new Blob, and reading its content via a Node.js Readable stream.
Migrate your project to ESM imports (`import ... from 'fetch-blob'`) or use dynamic `import()` for CJS compatibility (`const { Blob } = await import('fetch-blob')`). Ensure your Node.js version meets the minimum requirements.If you need a Node.js `Readable` stream, convert the WHATWG stream using `Readable.from(blob.stream())` from Node's built-in `stream` module.
No direct fix for existing code needed unless you were relying on implicit polyfills from `streams`. Continue to use `Readable.from()` for Node.js stream compatibility.
Consider if the native `Blob` (`new global.Blob(...)`) meets your needs for basic `Blob` functionality. For file system-backed operations or compatibility with older Node.js, `fetch-blob` remains the go-to.
Ensure you import these specific modules using their full path, including the `.js` extension (e.g., `import { File } from 'fetch-blob/file.js'`).If in a CommonJS module, use `const { Blob } = await import('fetch-blob');` or migrate your module to ESM.Verify the import path, ensuring it's `fetch-blob/file.js` for `File` or `fetch-blob/from.js` for `blobFrom` and related functions. Remember the explicit `.js` extension is crucial for ESM.
Convert the WHATWG stream to a Node.js `Readable` stream first using `Readable.from(blob.stream())`.
No dependency data recorded yet.