use `pump(zipStream, writeStream)`, the zip file at disk is nested one level more
WormGirl opened this issue · 1 comments
WormGirl commented
for example;
zip file: upload.zip include a foo.json
, then upload it use stream, when i get the stream at server. and do this;
const ctx = this.ctx;
const stream = await ctx.getFileStream();
const target = path.join(this.app.baseDir, 'app/upload', 'demo.zip');
const writeStream = createWriteStream(target);
pump(stream ,writeStream )
the file render at disk actualy is demo.zip inclued upload -> foo.json
. if I do this. it will be normal
const ctx = this.ctx;
const stream = await ctx.getFileStream();
const target = path.join(this.app.baseDir, 'app/upload', 'demo.zip');
const writeStream = createWriteStream(target);
stream.pipe(writeStream);
stream.on('finish', () => {
stream.close();
})
mafintosh commented
Doesn’t sound like a pump issue. Pump just pipes stream together. Maybe the zip thing is using a custom stream impl?
In anycase feel free to send a minimal runnable testcase with as few deps as possible and I’ll take a look