Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix the ignoreStream tests for Node.js v14.
Fixes jaydenseric/graphql-upload#209 .
- Loading branch information
1 parent
0847ecb
commit 2733ecb
Showing
3 changed files
with
27 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use strict'; | ||
|
||
const { Readable } = require('stream'); | ||
|
||
/** | ||
* A count readable stream, for testing purposes. | ||
* @kind class | ||
* @name CountReadableStream | ||
* @see [Example counting stream in the Node.js docs](https://nodejs.org/api/stream.html#stream_an_example_counting_stream). | ||
* @ignore | ||
*/ | ||
module.exports = class CountReadableStream extends Readable { | ||
constructor(options) { | ||
super(options); | ||
this._max = 1000000; | ||
this._index = 1; | ||
} | ||
|
||
_read() { | ||
const i = this._index++; | ||
this.push(i > this._max ? null : Buffer.from(String(i), 'ascii')); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters