This commit is contained in:
Trym Lund Flogard 2021-06-02 19:26:46 +02:00
parent 5b01b7a17b
commit d873964202
2 changed files with 728 additions and 725 deletions

1439
dist/index.js vendored

File diff suppressed because it is too large Load Diff

View File

@ -140,13 +140,15 @@ export class NextcloudClient {
private async zip(dirpath: string, destpath: string) {
const archive = archiver.create('zip', { zlib: { level: 9 } });
const stream = fsSync.createWriteStream(destpath);
archive.directory(dirpath, false)
.on('error', e => Promise.reject())
.on('close', () => Promise.resolve())
.pipe(stream);
const stream = archive.directory(dirpath, false)
.pipe(fsSync.createWriteStream(destpath));
return archive.finalize();
await archive.finalize();
return await new Promise<void>((resolve, reject) => {
stream.on('error', e => reject(e))
.on('finish', () => resolve());
})
}
private async upload(file: string) {