chore: finish piping and stuff and making it lovely

Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
blam
2022-07-21 16:31:02 +02:00
parent 22e9262868
commit 01d825ba28
2 changed files with 3 additions and 1 deletions
@@ -59,6 +59,7 @@ describe('ZipArchiveResponse', () => {
content: expect.any(Function),
},
]);
const contents = await Promise.all(files.map(f => f.content()));
expect(contents.map(c => c.toString('utf8').trim())).toEqual([
'site_name: Test',
@@ -190,8 +190,9 @@ export class ZipArchiveResponse implements ReadTreeResponse {
}
return new Promise(async (resolve, reject) => {
const file = fs.createWriteStream(platformPath.join(dir, entryPath));
file.on('error', reject);
file.on('finish', resolve);
content.on('error', reject);
content.pipe(file);
});
});