biketrack-app/node_modules/fetch-blob
2022-07-11 10:27:11 +02:00
..
CHANGELOG.md first commit in testing 2022-07-11 10:27:11 +02:00
from.d.ts first commit in testing 2022-07-11 10:27:11 +02:00
from.js first commit in testing 2022-07-11 10:27:11 +02:00
index.d.ts first commit in testing 2022-07-11 10:27:11 +02:00
index.js first commit in testing 2022-07-11 10:27:11 +02:00
LICENSE first commit in testing 2022-07-11 10:27:11 +02:00
package.json first commit in testing 2022-07-11 10:27:11 +02:00
README.md first commit in testing 2022-07-11 10:27:11 +02:00

fetch-blob

npm version build status coverage status install size

A Blob implementation in Node.js, originally from node-fetch.

Installation

npm install fetch-blob

Usage

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));

Blob part backed up by filesystem

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.