Repository URL to install this package:
Version:
0.6.0 ▾
|
.. |
CHANGELOG.md |
LICENSE |
README.md |
from.d.ts |
from.js |
index.d.ts |
index.js |
package.json |
A Blob implementation in Node.js, originally from node-fetch.
npm install fetch-blob
const Blob = require('fetch-blob'); const fetch = require('node-fetch'); fetch('https://httpbin.org/post', { method: 'POST', body: new Blob(['Hello World'], { type: 'text/plain' }) }) .then(res => res.json()); .then(json => console.log(json));
To use, install domexception.
npm install fetch-blob domexception
const blobFrom = require('fetch-blob/from.js'); const blob1 = blobFrom('./2-GiB-file.bin'); const blob2 = blobFrom('./2-GiB-file.bin'); // Not a 4 GiB memory snapshot, just holds 3 references // points to where data is located on the disk const blob = new Blob([blob1, blob2]); console.log(blob.size) // 4 GiB
See the MDN documentation and tests for more details.