Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
2c904cc1ec | |||
d1561ad1b7 | |||
0ae3fee987 | |||
047c2bd402 | |||
9ed3de718f | |||
14530f393c |
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@push.rocks/smartstream",
|
||||
"version": "2.0.5",
|
||||
"version": "2.0.8",
|
||||
"private": false,
|
||||
"description": "simplifies access to node streams",
|
||||
"main": "dist_ts/index.js",
|
||||
|
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/smartstream',
|
||||
version: '2.0.5',
|
||||
version: '2.0.8',
|
||||
description: 'simplifies access to node streams'
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
export * from './smartstream.classes.passthrough.js';
|
||||
export * from './smartstream.classes.smartstream.js';
|
||||
export * from './smartstream.classes.streamwrapper.js';
|
||||
export * from './smartstream.classes.streamintake.js';
|
||||
|
19
ts/smartstream.classes.passthrough.ts
Normal file
19
ts/smartstream.classes.passthrough.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import * as plugins from './smartstream.plugins.js';
|
||||
|
||||
export class PassThrough extends plugins.stream.Duplex {
|
||||
constructor(options?: plugins.stream.DuplexOptions) {
|
||||
super(options);
|
||||
}
|
||||
|
||||
_read(size: number): void {
|
||||
// No-op: Data written will be automatically available for reading.
|
||||
}
|
||||
|
||||
_write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void {
|
||||
if (this.push(chunk, encoding)) {
|
||||
callback();
|
||||
} else {
|
||||
this.once('drain', callback);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user