async create(ctx) {
ctx.attachment(filename);
ctx.set('Content-Type', mimetype);
const arch = fs.createWriteStream(path.join(__dirname, 'someArchive.zip'));
ctx.body = arch.on('close', () => {
console.log('writeStream was closed');
fs.createReadStream(file);
});
},
app.use(async ctx => {
await new Promise((resolve, reject) => {
const stream = fs.createWriteStream(...)
stream.on('close', () => {
ctx.body = fs.createReadStream(...)
resolve()
})
})
})