I hereby claim:
- I am tytrdev on github.
- I am tydev (https://keybase.io/tydev) on keybase.
- I have a public key ASATuq1VtDGPELGW335z9SqdYaReD2x2dHD7hkxg-jsATgo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
_read(n) { | |
this.bytesRead += n; | |
const value = this.buffer.toString('utf-8', this.bytesRead - n, this.bytesRead); | |
this.push(value || null); | |
} |
const duplex = new MyDuplexStream(numberOfBytes); | |
const writeStream = getWriteStreamSomehow(); | |
duplex.pipe(writeStream); |
const { Duplex } = require('stream'); | |
class MyDuplexStream extends Duplex { | |
constructor(bytes) { | |
this.buffer = Buffer.alloc(bytes, '', 'utf-8'); | |
this.bytesRead = 0; | |
} | |
_read(n) { | |
this.bytesRead += n; |