chore: Update dependencies

Signed-off-by: Richie Bendall <richiebendall@gmail.com>
This commit is contained in:
Richie Bendall
2020-02-13 21:48:24 +13:00
parent f336a8d182
commit 1f5258cd79
6 changed files with 4430 additions and 64 deletions
+2 -3
View File
@@ -1,10 +1,9 @@
language: node_js
node_js:
- "8"
- "10"
- "12"
- "lts/*"
- "node"
script:
- npm run lint
- npm run coverage
cache:
directories:
+1 -1
View File
@@ -7,7 +7,7 @@ fetch-blob
[![coverage status][codecov-image]][codecov-url]
[![install size][install-size-image]][install-size-url]
A Blob implementation on node.js, originally from node-fetch
A Blob implementation in Node.js, originally from node-fetch.
## Usage
+1 -4
View File
@@ -1,10 +1,7 @@
// Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js
// (MIT licensed)
const Stream = require('stream');
// Fix for "Readable" isn't a named export issue
const {Readable} = Stream;
const {Readable} = require('stream');
const BUFFER = Symbol('buffer');
const TYPE = Symbol('type');
+12 -10
View File
@@ -1,32 +1,34 @@
{
"name": "fetch-blob",
"version": "1.0.5",
"description": "A Blob implementation on node.js, originally from node-fetch",
"description": "A Blob implementation in Node.js, originally from node-fetch.",
"main": "blob.js",
"scripts": {
"test": "ava",
"lint": "xo",
"test": "xo && ava",
"report": "nyc ava",
"coverage": "nyc --reporter json --reporter text ava && codecov -f coverage/coverage-final.json"
},
"repository": {
"type": "git",
"url": "git+https://github.com/bitinn/fetch-blob.git"
},
"repository": "https://github.com/node-fetch/fetch-blob.git",
"keywords": [
"blob",
"node-fetch"
],
"engines": {
"node": ">=6"
},
"author": "David Frank",
"license": "MIT",
"bugs": {
"url": "https://github.com/bitinn/fetch-blob/issues"
"url": "https://github.com/node-fetch/fetch-blob/issues"
},
"homepage": "https://github.com/bitinn/fetch-blob#readme",
"homepage": "https://github.com/node-fetch/fetch-blob#readme",
"devDependencies": {
"ava": "^1.4.1",
"ava": "^3.3.0",
"codecov": "^3.6.1",
"get-stream": "^5.1.0",
"node-fetch": "^2.6.0",
"nyc": "^14.1.1"
"nyc": "^15.0.0",
"xo": "^0.26.0"
}
}
+40 -46
View File
@@ -1,87 +1,81 @@
import test from 'ava';
import Blob from './blob';
import util from 'util';
import stream from 'stream';
import getStream from 'get-stream';
import { Response } from 'node-fetch';
const TextDecoder = util.TextDecoder;
const Readable = stream.Readable;
const test = require('ava');
const Blob = require('./blob');
const getStream = require('get-stream');
const {Response} = require('node-fetch');
test('Blob ctor', t => {
let data = 'a=1';
let blob = new Blob([data]);
const data = 'a=1';
const blob = new Blob([data]); // eslint-disable-line no-unused-vars
t.pass();
});
test('Blob size', t => {
let data = 'a=1';
let blob = new Blob([data]);
const data = 'a=1';
const blob = new Blob([data]);
t.is(blob.size, data.length);
});
test('Blob type', t => {
let data = 'a=1';
let type = 'text/plain';
let blob = new Blob([data], { type });
const data = 'a=1';
const type = 'text/plain';
const blob = new Blob([data], {type});
t.is(blob.type, type);
});
test('Blob text()', async t => {
let data = 'a=1';
let type = 'text/plain';
let blob = new Blob([data], { type });
const data = 'a=1';
const type = 'text/plain';
const blob = new Blob([data], {type});
t.is(await blob.text(), data);
});
test('Blob arrayBuffer()', async t => {
let data = 'a=1';
let type = 'text/plain';
let blob = new Blob([data], { type });
const data = 'a=1';
const type = 'text/plain';
const blob = new Blob([data], {type});
let decoder = new TextDecoder('utf-8');
let buffer = await blob.arrayBuffer();
const decoder = new TextDecoder('utf-8');
const buffer = await blob.arrayBuffer();
t.is(decoder.decode(buffer), data);
});
test('Blob stream()', async t => {
let data = 'a=1';
let type = 'text/plain';
let blob = new Blob([data], { type });
let result = await getStream(blob.stream());
const data = 'a=1';
const type = 'text/plain';
const blob = new Blob([data], {type});
const result = await getStream(blob.stream());
t.is(result, data);
});
test('Blob toString()', t => {
let data = 'a=1';
let type = 'text/plain';
let blob = new Blob([data], { type });
const data = 'a=1';
const type = 'text/plain';
const blob = new Blob([data], {type});
t.is(blob.toString(), '[object Blob]');
});
test('Blob slice()', async t => {
let data = 'a=1';
let type = 'text/plain';
let blob = new Blob([data], { type });
let blob2 = blob.slice(0, 1);
const data = 'a=1';
const type = 'text/plain';
const blob = new Blob([data], {type});
const blob2 = blob.slice(0, 1);
t.is(await blob2.text(), data.slice(0, 1));
});
test('Blob works with node-fetch Response.blob()', async t => {
let data = 'a=1';
let type = 'text/plain';
let blob = new Blob([data], { type });
let res = new Response(blob);
let blob2 = await res.blob();
const data = 'a=1';
const type = 'text/plain';
const blob = new Blob([data], {type});
const res = new Response(blob);
const blob2 = await res.blob();
t.is(await blob2.text(), data);
});
test('Blob works with node-fetch Response.text()', async t => {
let data = 'a=1';
let type = 'text/plain';
let blob = new Blob([data], { type });
let res = new Response(blob);
let text = await res.text();
const data = 'a=1';
const type = 'text/plain';
const blob = new Blob([data], {type});
const res = new Response(blob);
const text = await res.text();
t.is(text, data);
});
+4374
View File
File diff suppressed because it is too large Load Diff