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. 14
      packages/nocodb/src/lib/utils/pluginUtils.ts

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

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

Loading…
Cancel
Save