Browse Source

feat(nocodb): catch error and put steam.end inside promise

pull/4219/head
Wing-Kam Wong 2 years ago
parent
commit
1fff7634af
  1. 10
      packages/nocodb/src/lib/utils/pluginUtils.ts

10
packages/nocodb/src/lib/utils/pluginUtils.ts

@ -3,10 +3,14 @@ import fs from 'fs';
export async function waitForStreamClose( export async function waitForStreamClose(
stream: fs.WriteStream stream: fs.WriteStream
): Promise<void> { ): Promise<void> {
stream.end(); return new Promise((resolve, reject) => {
return new Promise((resolve) => { stream
stream.once('finish', () => { .once('finish', () => {
resolve(); resolve();
})
.once('error', () => {
reject();
}); });
stream.end();
}); });
} }

Loading…
Cancel
Save