From 97e73b5df1cc49e8eee16d4d8adfcbacc10201b1 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Fri, 28 Oct 2022 13:06:00 +0800 Subject: [PATCH] feat(nocodb): add waitForStreamClose to pluginUtils --- packages/nocodb/src/lib/utils/pluginUtils.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 packages/nocodb/src/lib/utils/pluginUtils.ts diff --git a/packages/nocodb/src/lib/utils/pluginUtils.ts b/packages/nocodb/src/lib/utils/pluginUtils.ts new file mode 100644 index 0000000000..8df3d425dc --- /dev/null +++ b/packages/nocodb/src/lib/utils/pluginUtils.ts @@ -0,0 +1,12 @@ +import fs from 'fs'; + +export async function waitForStreamClose( + stream: fs.WriteStream +): Promise { + stream.end(); + return new Promise((resolve) => { + stream.once('finish', () => { + resolve(); + }); + }); +}