fix(core): update

This commit is contained in:
Philipp Kunz 2023-11-02 00:30:15 +01:00
parent 0ae3fee987
commit d1561ad1b7
3 changed files with 21 additions and 1 deletions

View File

@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@push.rocks/smartstream', name: '@push.rocks/smartstream',
version: '2.0.7', version: '2.0.8',
description: 'simplifies access to node streams' description: 'simplifies access to node streams'
} }

View File

@ -1,3 +1,4 @@
export * from './smartstream.classes.passthrough.js';
export * from './smartstream.classes.smartstream.js'; export * from './smartstream.classes.smartstream.js';
export * from './smartstream.classes.streamwrapper.js'; export * from './smartstream.classes.streamwrapper.js';
export * from './smartstream.classes.streamintake.js'; export * from './smartstream.classes.streamintake.js';

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