-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Open
Description
Version
22.17.0
Platform
Microsoft Windows NT 10.0.19045.0 x64
Subsystem
No response
What steps will reproduce the bug?
use zstd compress file
import fs from 'fs';
import path from 'path';
import { Readable } from 'stream';
import { pipeline } from 'stream/promises';
import { constants, createZstdCompress } from 'zlib';
(async () => {
function createBlankStream(count: number) {
return new (class extends Readable {
readCount = 0;
constructor() {
super({ highWaterMark: 8 * 1024 * 1024 });
}
override _read(size: number) {
this.readCount += size;
const needSize = this.readCount > count ? size - (this.readCount - count) : size;
this.push(Buffer.alloc(needSize, 0));
if (needSize !== size) {
this.push(null);
}
}
})();
}
let zstdC = createZstdCompress({
params: {
[constants.ZSTD_c_compressionLevel]: 1,
[constants.ZSTD_c_nbWorkers]: 1,
},
});
//If no exceptions are reported, you can try increasing the buffer
await pipeline(createBlankStream(8 * 1024 * 1024+1), zstdC, fs.createWriteStream(path.join(process.cwd(), '11.tar')));
})();
How often does it reproduce? Is there a required condition?
This bug is 100% reproducible.
What is the expected behavior? Why is that the expected behavior?
work
What do you see instead?
Error [ERR_STREAM_PUSH_AFTER_EOF]: stream.push() after EOF
at readableAddChunkPushByteMode (node:internal/streams/readable:495:28)
at Readable.push (node:internal/streams/readable:392:5)
at ZstdCompress.processCallback (node:zlib:536:32)
Emitted 'error' event on ZstdCompress instance at:
at emitErrorNT (node:internal/streams/destroy:170:8)
at emitErrorCloseNT (node:internal/streams/destroy:129:3)
at process.processTicksAndRejections (node:internal/process/task_queues:90:21) {
code: 'ERR_STREAM_PUSH_AFTER_EOF'
}
Additional information
No response
Metadata
Metadata
Assignees
Labels
No labels