Skip to content
Permalink
Browse files
Require Node.js 10
  • Loading branch information
sindresorhus committed Aug 10, 2020
1 parent 5cf31ba commit 80165c16f5a4a237fef7f8b716a84812f8e4bd63
Showing with 9 additions and 15 deletions.
  1. +0 −1 .travis.yml
  2. +0 −3 index.d.ts
  3. +1 −3 index.js
  4. +3 −3 index.test-d.ts
  5. +3 −3 package.json
  6. +2 −2 test.js
@@ -3,4 +3,3 @@ node_js:
- '14'
- '12'
- '10'
- '8'
@@ -100,9 +100,6 @@ declare const getStream: {
): Promise<string[]>;

MaxBufferError: typeof MaxBufferErrorClass;

// TODO: Remove this for the next major release
default: typeof getStream;
};

export = getStream;
@@ -24,8 +24,8 @@ async function getStream(inputStream, options) {
};

const {maxBuffer} = options;

const stream = bufferStream(options);

await new Promise((resolve, reject) => {
const rejectPromise = error => {
// Don't retrieve an oversized buffer.
@@ -56,8 +56,6 @@ async function getStream(inputStream, options) {
}

module.exports = getStream;
// TODO: Remove this for the next major release
module.exports.default = getStream;
module.exports.buffer = (stream, options) => getStream(stream, {...options, encoding: 'buffer'});
module.exports.array = (stream, options) => getStream(stream, {...options, array: true});
module.exports.MaxBufferError = MaxBufferError;
@@ -13,9 +13,9 @@ expectType<Promise<Buffer>>(getStream.buffer(stream));
expectType<Promise<Buffer>>(getStream.buffer(stream, {maxBuffer: 10}));
expectType<Promise<Buffer>>(getStream.buffer(stream, {encoding: 'utf8'}));

expectType<Promise<unknown>>(getStream.array(stream));
expectType<Promise<{}>>(getStream.array<{}>(stream));
expectType<Promise<unknown>>(getStream.array(stream, {maxBuffer: 10}));
expectType<Promise<unknown[]>>(getStream.array(stream));
expectType<Promise<{}[]>>(getStream.array<{}>(stream));
expectType<Promise<unknown[]>>(getStream.array(stream, {maxBuffer: 10}));
expectType<Promise<Buffer[]>>(getStream.array(stream, {encoding: 'buffer'}));
expectType<Promise<Buffer[]>>(
getStream.array(stream, {maxBuffer: 10, encoding: 'buffer'})
@@ -38,10 +38,10 @@
"object"
],
"devDependencies": {
"@types/node": "^12.0.7",
"ava": "^2.0.0",
"@types/node": "^14.0.27",
"ava": "^2.4.0",
"into-stream": "^5.0.0",
"tsd": "^0.7.2",
"tsd": "^0.13.1",
"xo": "^0.24.0"
}
}
@@ -7,8 +7,8 @@ import getStream from '.';

function makeSetup(intoStream) {
const setup = (streamDef, options) => getStream(intoStream(streamDef), options);
setup.array = (streamDef, opts) => getStream.array(intoStream(streamDef), opts);
setup.buffer = (streamDef, opts) => getStream.buffer(intoStream(streamDef), opts);
setup.array = (streamDef, options) => getStream.array(intoStream(streamDef), options);
setup.buffer = (streamDef, options) => getStream.buffer(intoStream(streamDef), options);
return setup;
}

0 comments on commit 80165c1

Please sign in to comment.