diff --git a/packages/nocodb/src/lib/plugins/backblaze/Backblaze.ts b/packages/nocodb/src/lib/plugins/backblaze/Backblaze.ts index 16a757d081..d8f8fbeef2 100644 --- a/packages/nocodb/src/lib/plugins/backblaze/Backblaze.ts +++ b/packages/nocodb/src/lib/plugins/backblaze/Backblaze.ts @@ -1,9 +1,9 @@ import fs from 'fs'; import path from 'path'; - import AWS from 'aws-sdk'; import { IStorageAdapterV2, XcFile } from 'nc-plugin'; import request from 'request'; +import { waitForStreamClose } from '../../utils/pluginUtils'; export default class Backblaze implements IStorageAdapterV2 { private s3Client: AWS.S3; @@ -121,7 +121,7 @@ export default class Backblaze implements IStorageAdapterV2 { try { const tempFile = path.join(process.cwd(), 'temp.txt'); const createStream = fs.createWriteStream(tempFile); - createStream.end(); + await waitForStreamClose(createStream); await this.fileCreate('nc-test-file.txt', { path: tempFile, mimetype: '', diff --git a/packages/nocodb/src/lib/plugins/gcs/Gcs.ts b/packages/nocodb/src/lib/plugins/gcs/Gcs.ts index ccb99e81b5..ed4e602c1a 100644 --- a/packages/nocodb/src/lib/plugins/gcs/Gcs.ts +++ b/packages/nocodb/src/lib/plugins/gcs/Gcs.ts @@ -1,9 +1,9 @@ import fs from 'fs'; import path from 'path'; - import { Storage, StorageOptions } from '@google-cloud/storage'; import { IStorageAdapterV2, XcFile } from 'nc-plugin'; import request from 'request'; +import { waitForStreamClose } from '../../utils/pluginUtils'; export default class Gcs implements IStorageAdapterV2 { private storageClient: Storage; @@ -87,7 +87,7 @@ export default class Gcs implements IStorageAdapterV2 { try { const tempFile = path.join(process.cwd(), 'temp.txt'); const createStream = fs.createWriteStream(tempFile); - createStream.end(); + await waitForStreamClose(createStream); await this.fileCreate('nc-test-file.txt', { path: tempFile, mimetype: '', diff --git a/packages/nocodb/src/lib/plugins/linode/LinodeObjectStorage.ts b/packages/nocodb/src/lib/plugins/linode/LinodeObjectStorage.ts index 616709fbf2..a2f4672074 100644 --- a/packages/nocodb/src/lib/plugins/linode/LinodeObjectStorage.ts +++ b/packages/nocodb/src/lib/plugins/linode/LinodeObjectStorage.ts @@ -1,9 +1,9 @@ import fs from 'fs'; import path from 'path'; - import AWS from 'aws-sdk'; import { IStorageAdapterV2, XcFile } from 'nc-plugin'; import request from 'request'; +import { waitForStreamClose } from '../../utils/pluginUtils'; export default class LinodeObjectStorage implements IStorageAdapterV2 { private s3Client: AWS.S3; @@ -111,7 +111,7 @@ export default class LinodeObjectStorage implements IStorageAdapterV2 { try { const tempFile = path.join(process.cwd(), 'temp.txt'); const createStream = fs.createWriteStream(tempFile); - createStream.end(); + await waitForStreamClose(createStream); await this.fileCreate('nc-test-file.txt', { path: tempFile, mimetype: '', diff --git a/packages/nocodb/src/lib/plugins/mino/Minio.ts b/packages/nocodb/src/lib/plugins/mino/Minio.ts index 1a2765ff6b..5cea82c9e8 100644 --- a/packages/nocodb/src/lib/plugins/mino/Minio.ts +++ b/packages/nocodb/src/lib/plugins/mino/Minio.ts @@ -1,9 +1,9 @@ import fs from 'fs'; import path from 'path'; - import { Client as MinioClient } from 'minio'; import { IStorageAdapterV2, XcFile } from 'nc-plugin'; import request from 'request'; +import { waitForStreamClose } from '../../utils/pluginUtils'; export default class Minio implements IStorageAdapterV2 { private minioClient: MinioClient; @@ -75,7 +75,7 @@ export default class Minio implements IStorageAdapterV2 { try { const tempFile = path.join(process.cwd(), 'temp.txt'); const createStream = fs.createWriteStream(tempFile); - createStream.end(); + await waitForStreamClose(createStream); await this.fileCreate('nc-test-file.txt', { path: tempFile, mimetype: '', diff --git a/packages/nocodb/src/lib/plugins/ovhCloud/OvhCloud.ts b/packages/nocodb/src/lib/plugins/ovhCloud/OvhCloud.ts index b374ff43e8..e4e973e391 100644 --- a/packages/nocodb/src/lib/plugins/ovhCloud/OvhCloud.ts +++ b/packages/nocodb/src/lib/plugins/ovhCloud/OvhCloud.ts @@ -1,9 +1,9 @@ import fs from 'fs'; import path from 'path'; - import AWS from 'aws-sdk'; import { IStorageAdapterV2, XcFile } from 'nc-plugin'; import request from 'request'; +import { waitForStreamClose } from '../../utils/pluginUtils'; export default class OvhCloud implements IStorageAdapterV2 { private s3Client: AWS.S3; @@ -111,7 +111,7 @@ export default class OvhCloud implements IStorageAdapterV2 { try { const tempFile = path.join(process.cwd(), 'temp.txt'); const createStream = fs.createWriteStream(tempFile); - createStream.end(); + await waitForStreamClose(createStream); await this.fileCreate('nc-test-file.txt', { path: tempFile, mimetype: '', diff --git a/packages/nocodb/src/lib/plugins/s3/S3.ts b/packages/nocodb/src/lib/plugins/s3/S3.ts index 3d3e91b164..d01bc98551 100644 --- a/packages/nocodb/src/lib/plugins/s3/S3.ts +++ b/packages/nocodb/src/lib/plugins/s3/S3.ts @@ -1,9 +1,9 @@ import fs from 'fs'; import path from 'path'; - import AWS from 'aws-sdk'; import { IStorageAdapterV2, XcFile } from 'nc-plugin'; import request from 'request'; +import { waitForStreamClose } from '../../utils/pluginUtils'; export default class S3 implements IStorageAdapterV2 { private s3Client: AWS.S3; @@ -114,7 +114,7 @@ export default class S3 implements IStorageAdapterV2 { try { const tempFile = path.join(process.cwd(), 'temp.txt'); const createStream = fs.createWriteStream(tempFile); - createStream.end(); + await waitForStreamClose(createStream); await this.fileCreate('nc-test-file.txt', { path: tempFile, mimetype: '', diff --git a/packages/nocodb/src/lib/plugins/scaleway/ScalewayObjectStorage.ts b/packages/nocodb/src/lib/plugins/scaleway/ScalewayObjectStorage.ts index 79803afc75..4b21d5c1c3 100644 --- a/packages/nocodb/src/lib/plugins/scaleway/ScalewayObjectStorage.ts +++ b/packages/nocodb/src/lib/plugins/scaleway/ScalewayObjectStorage.ts @@ -3,6 +3,7 @@ import fs from 'fs'; import { IStorageAdapterV2, XcFile } from 'nc-plugin'; import AWS from 'aws-sdk'; import request from 'request'; +import { waitForStreamClose } from '../../utils/pluginUtils'; export default class ScalewayObjectStorage implements IStorageAdapterV2 { private s3Client: AWS.S3; @@ -30,7 +31,7 @@ export default class ScalewayObjectStorage implements IStorageAdapterV2 { try { const tempFile = path.join(process.cwd(), 'temp.txt'); const createStream = fs.createWriteStream(tempFile); - createStream.end(); + await waitForStreamClose(createStream); await this.fileCreate('nc-test-file.txt', { path: tempFile, mimetype: '', diff --git a/packages/nocodb/src/lib/plugins/spaces/Spaces.ts b/packages/nocodb/src/lib/plugins/spaces/Spaces.ts index dcb2e1a9de..54624cabf9 100644 --- a/packages/nocodb/src/lib/plugins/spaces/Spaces.ts +++ b/packages/nocodb/src/lib/plugins/spaces/Spaces.ts @@ -1,9 +1,9 @@ import fs from 'fs'; import path from 'path'; - import AWS from 'aws-sdk'; import { IStorageAdapterV2, XcFile } from 'nc-plugin'; import request from 'request'; +import { waitForStreamClose } from '../../utils/pluginUtils'; export default class Spaces implements IStorageAdapterV2 { private s3Client: AWS.S3; @@ -119,7 +119,7 @@ export default class Spaces implements IStorageAdapterV2 { try { const tempFile = path.join(process.cwd(), 'temp.txt'); const createStream = fs.createWriteStream(tempFile); - createStream.end(); + await waitForStreamClose(createStream); await this.fileCreate('nc-test-file.txt', { path: tempFile, mimetype: '', diff --git a/packages/nocodb/src/lib/plugins/upcloud/UpoCloud.ts b/packages/nocodb/src/lib/plugins/upcloud/UpoCloud.ts index 0186a16bbc..32ed516349 100644 --- a/packages/nocodb/src/lib/plugins/upcloud/UpoCloud.ts +++ b/packages/nocodb/src/lib/plugins/upcloud/UpoCloud.ts @@ -1,9 +1,9 @@ import fs from 'fs'; import path from 'path'; - import AWS from 'aws-sdk'; import { IStorageAdapterV2, XcFile } from 'nc-plugin'; import request from 'request'; +import { waitForStreamClose } from '../../utils/pluginUtils'; export default class UpoCloud implements IStorageAdapterV2 { private s3Client: AWS.S3; @@ -109,7 +109,7 @@ export default class UpoCloud implements IStorageAdapterV2 { try { const tempFile = path.join(process.cwd(), 'temp.txt'); const createStream = fs.createWriteStream(tempFile); - createStream.end(); + await waitForStreamClose(createStream); await this.fileCreate('nc-test-file.txt', { path: tempFile, mimetype: '', diff --git a/packages/nocodb/src/lib/plugins/vultr/Vultr.ts b/packages/nocodb/src/lib/plugins/vultr/Vultr.ts index 84e1a4cbbe..ddd1b9f51c 100644 --- a/packages/nocodb/src/lib/plugins/vultr/Vultr.ts +++ b/packages/nocodb/src/lib/plugins/vultr/Vultr.ts @@ -1,9 +1,9 @@ import fs from 'fs'; import path from 'path'; - import AWS from 'aws-sdk'; import { IStorageAdapterV2, XcFile } from 'nc-plugin'; import request from 'request'; +import { waitForStreamClose } from '../../utils/pluginUtils'; export default class Vultr implements IStorageAdapterV2 { private s3Client: AWS.S3; @@ -111,7 +111,7 @@ export default class Vultr implements IStorageAdapterV2 { try { const tempFile = path.join(process.cwd(), 'temp.txt'); const createStream = fs.createWriteStream(tempFile); - createStream.end(); + await waitForStreamClose(createStream); await this.fileCreate('nc-test-file.txt', { path: tempFile, mimetype: '',