Browse Source

fix(nocodb): apply waitForStreamClose

pull/4219/head
Wing-Kam Wong 2 years ago
parent
commit
3c0936ad6b
  1. 4
      packages/nocodb/src/lib/plugins/backblaze/Backblaze.ts
  2. 4
      packages/nocodb/src/lib/plugins/gcs/Gcs.ts
  3. 4
      packages/nocodb/src/lib/plugins/linode/LinodeObjectStorage.ts
  4. 4
      packages/nocodb/src/lib/plugins/mino/Minio.ts
  5. 4
      packages/nocodb/src/lib/plugins/ovhCloud/OvhCloud.ts
  6. 4
      packages/nocodb/src/lib/plugins/s3/S3.ts
  7. 3
      packages/nocodb/src/lib/plugins/scaleway/ScalewayObjectStorage.ts
  8. 4
      packages/nocodb/src/lib/plugins/spaces/Spaces.ts
  9. 4
      packages/nocodb/src/lib/plugins/upcloud/UpoCloud.ts
  10. 4
      packages/nocodb/src/lib/plugins/vultr/Vultr.ts

4
packages/nocodb/src/lib/plugins/backblaze/Backblaze.ts

@ -1,9 +1,9 @@
import fs from 'fs'; import fs from 'fs';
import path from 'path'; import path from 'path';
import AWS from 'aws-sdk'; import AWS from 'aws-sdk';
import { IStorageAdapterV2, XcFile } from 'nc-plugin'; import { IStorageAdapterV2, XcFile } from 'nc-plugin';
import request from 'request'; import request from 'request';
import { waitForStreamClose } from '../../utils/pluginUtils';
export default class Backblaze implements IStorageAdapterV2 { export default class Backblaze implements IStorageAdapterV2 {
private s3Client: AWS.S3; private s3Client: AWS.S3;
@ -121,7 +121,7 @@ export default class Backblaze implements IStorageAdapterV2 {
try { try {
const tempFile = path.join(process.cwd(), 'temp.txt'); const tempFile = path.join(process.cwd(), 'temp.txt');
const createStream = fs.createWriteStream(tempFile); const createStream = fs.createWriteStream(tempFile);
createStream.end(); await waitForStreamClose(createStream);
await this.fileCreate('nc-test-file.txt', { await this.fileCreate('nc-test-file.txt', {
path: tempFile, path: tempFile,
mimetype: '', mimetype: '',

4
packages/nocodb/src/lib/plugins/gcs/Gcs.ts

@ -1,9 +1,9 @@
import fs from 'fs'; import fs from 'fs';
import path from 'path'; import path from 'path';
import { Storage, StorageOptions } from '@google-cloud/storage'; import { Storage, StorageOptions } from '@google-cloud/storage';
import { IStorageAdapterV2, XcFile } from 'nc-plugin'; import { IStorageAdapterV2, XcFile } from 'nc-plugin';
import request from 'request'; import request from 'request';
import { waitForStreamClose } from '../../utils/pluginUtils';
export default class Gcs implements IStorageAdapterV2 { export default class Gcs implements IStorageAdapterV2 {
private storageClient: Storage; private storageClient: Storage;
@ -87,7 +87,7 @@ export default class Gcs implements IStorageAdapterV2 {
try { try {
const tempFile = path.join(process.cwd(), 'temp.txt'); const tempFile = path.join(process.cwd(), 'temp.txt');
const createStream = fs.createWriteStream(tempFile); const createStream = fs.createWriteStream(tempFile);
createStream.end(); await waitForStreamClose(createStream);
await this.fileCreate('nc-test-file.txt', { await this.fileCreate('nc-test-file.txt', {
path: tempFile, path: tempFile,
mimetype: '', mimetype: '',

4
packages/nocodb/src/lib/plugins/linode/LinodeObjectStorage.ts

@ -1,9 +1,9 @@
import fs from 'fs'; import fs from 'fs';
import path from 'path'; import path from 'path';
import AWS from 'aws-sdk'; import AWS from 'aws-sdk';
import { IStorageAdapterV2, XcFile } from 'nc-plugin'; import { IStorageAdapterV2, XcFile } from 'nc-plugin';
import request from 'request'; import request from 'request';
import { waitForStreamClose } from '../../utils/pluginUtils';
export default class LinodeObjectStorage implements IStorageAdapterV2 { export default class LinodeObjectStorage implements IStorageAdapterV2 {
private s3Client: AWS.S3; private s3Client: AWS.S3;
@ -111,7 +111,7 @@ export default class LinodeObjectStorage implements IStorageAdapterV2 {
try { try {
const tempFile = path.join(process.cwd(), 'temp.txt'); const tempFile = path.join(process.cwd(), 'temp.txt');
const createStream = fs.createWriteStream(tempFile); const createStream = fs.createWriteStream(tempFile);
createStream.end(); await waitForStreamClose(createStream);
await this.fileCreate('nc-test-file.txt', { await this.fileCreate('nc-test-file.txt', {
path: tempFile, path: tempFile,
mimetype: '', mimetype: '',

4
packages/nocodb/src/lib/plugins/mino/Minio.ts

@ -1,9 +1,9 @@
import fs from 'fs'; import fs from 'fs';
import path from 'path'; import path from 'path';
import { Client as MinioClient } from 'minio'; import { Client as MinioClient } from 'minio';
import { IStorageAdapterV2, XcFile } from 'nc-plugin'; import { IStorageAdapterV2, XcFile } from 'nc-plugin';
import request from 'request'; import request from 'request';
import { waitForStreamClose } from '../../utils/pluginUtils';
export default class Minio implements IStorageAdapterV2 { export default class Minio implements IStorageAdapterV2 {
private minioClient: MinioClient; private minioClient: MinioClient;
@ -75,7 +75,7 @@ export default class Minio implements IStorageAdapterV2 {
try { try {
const tempFile = path.join(process.cwd(), 'temp.txt'); const tempFile = path.join(process.cwd(), 'temp.txt');
const createStream = fs.createWriteStream(tempFile); const createStream = fs.createWriteStream(tempFile);
createStream.end(); await waitForStreamClose(createStream);
await this.fileCreate('nc-test-file.txt', { await this.fileCreate('nc-test-file.txt', {
path: tempFile, path: tempFile,
mimetype: '', mimetype: '',

4
packages/nocodb/src/lib/plugins/ovhCloud/OvhCloud.ts

@ -1,9 +1,9 @@
import fs from 'fs'; import fs from 'fs';
import path from 'path'; import path from 'path';
import AWS from 'aws-sdk'; import AWS from 'aws-sdk';
import { IStorageAdapterV2, XcFile } from 'nc-plugin'; import { IStorageAdapterV2, XcFile } from 'nc-plugin';
import request from 'request'; import request from 'request';
import { waitForStreamClose } from '../../utils/pluginUtils';
export default class OvhCloud implements IStorageAdapterV2 { export default class OvhCloud implements IStorageAdapterV2 {
private s3Client: AWS.S3; private s3Client: AWS.S3;
@ -111,7 +111,7 @@ export default class OvhCloud implements IStorageAdapterV2 {
try { try {
const tempFile = path.join(process.cwd(), 'temp.txt'); const tempFile = path.join(process.cwd(), 'temp.txt');
const createStream = fs.createWriteStream(tempFile); const createStream = fs.createWriteStream(tempFile);
createStream.end(); await waitForStreamClose(createStream);
await this.fileCreate('nc-test-file.txt', { await this.fileCreate('nc-test-file.txt', {
path: tempFile, path: tempFile,
mimetype: '', mimetype: '',

4
packages/nocodb/src/lib/plugins/s3/S3.ts

@ -1,9 +1,9 @@
import fs from 'fs'; import fs from 'fs';
import path from 'path'; import path from 'path';
import AWS from 'aws-sdk'; import AWS from 'aws-sdk';
import { IStorageAdapterV2, XcFile } from 'nc-plugin'; import { IStorageAdapterV2, XcFile } from 'nc-plugin';
import request from 'request'; import request from 'request';
import { waitForStreamClose } from '../../utils/pluginUtils';
export default class S3 implements IStorageAdapterV2 { export default class S3 implements IStorageAdapterV2 {
private s3Client: AWS.S3; private s3Client: AWS.S3;
@ -114,7 +114,7 @@ export default class S3 implements IStorageAdapterV2 {
try { try {
const tempFile = path.join(process.cwd(), 'temp.txt'); const tempFile = path.join(process.cwd(), 'temp.txt');
const createStream = fs.createWriteStream(tempFile); const createStream = fs.createWriteStream(tempFile);
createStream.end(); await waitForStreamClose(createStream);
await this.fileCreate('nc-test-file.txt', { await this.fileCreate('nc-test-file.txt', {
path: tempFile, path: tempFile,
mimetype: '', mimetype: '',

3
packages/nocodb/src/lib/plugins/scaleway/ScalewayObjectStorage.ts

@ -3,6 +3,7 @@ import fs from 'fs';
import { IStorageAdapterV2, XcFile } from 'nc-plugin'; import { IStorageAdapterV2, XcFile } from 'nc-plugin';
import AWS from 'aws-sdk'; import AWS from 'aws-sdk';
import request from 'request'; import request from 'request';
import { waitForStreamClose } from '../../utils/pluginUtils';
export default class ScalewayObjectStorage implements IStorageAdapterV2 { export default class ScalewayObjectStorage implements IStorageAdapterV2 {
private s3Client: AWS.S3; private s3Client: AWS.S3;
@ -30,7 +31,7 @@ export default class ScalewayObjectStorage implements IStorageAdapterV2 {
try { try {
const tempFile = path.join(process.cwd(), 'temp.txt'); const tempFile = path.join(process.cwd(), 'temp.txt');
const createStream = fs.createWriteStream(tempFile); const createStream = fs.createWriteStream(tempFile);
createStream.end(); await waitForStreamClose(createStream);
await this.fileCreate('nc-test-file.txt', { await this.fileCreate('nc-test-file.txt', {
path: tempFile, path: tempFile,
mimetype: '', mimetype: '',

4
packages/nocodb/src/lib/plugins/spaces/Spaces.ts

@ -1,9 +1,9 @@
import fs from 'fs'; import fs from 'fs';
import path from 'path'; import path from 'path';
import AWS from 'aws-sdk'; import AWS from 'aws-sdk';
import { IStorageAdapterV2, XcFile } from 'nc-plugin'; import { IStorageAdapterV2, XcFile } from 'nc-plugin';
import request from 'request'; import request from 'request';
import { waitForStreamClose } from '../../utils/pluginUtils';
export default class Spaces implements IStorageAdapterV2 { export default class Spaces implements IStorageAdapterV2 {
private s3Client: AWS.S3; private s3Client: AWS.S3;
@ -119,7 +119,7 @@ export default class Spaces implements IStorageAdapterV2 {
try { try {
const tempFile = path.join(process.cwd(), 'temp.txt'); const tempFile = path.join(process.cwd(), 'temp.txt');
const createStream = fs.createWriteStream(tempFile); const createStream = fs.createWriteStream(tempFile);
createStream.end(); await waitForStreamClose(createStream);
await this.fileCreate('nc-test-file.txt', { await this.fileCreate('nc-test-file.txt', {
path: tempFile, path: tempFile,
mimetype: '', mimetype: '',

4
packages/nocodb/src/lib/plugins/upcloud/UpoCloud.ts

@ -1,9 +1,9 @@
import fs from 'fs'; import fs from 'fs';
import path from 'path'; import path from 'path';
import AWS from 'aws-sdk'; import AWS from 'aws-sdk';
import { IStorageAdapterV2, XcFile } from 'nc-plugin'; import { IStorageAdapterV2, XcFile } from 'nc-plugin';
import request from 'request'; import request from 'request';
import { waitForStreamClose } from '../../utils/pluginUtils';
export default class UpoCloud implements IStorageAdapterV2 { export default class UpoCloud implements IStorageAdapterV2 {
private s3Client: AWS.S3; private s3Client: AWS.S3;
@ -109,7 +109,7 @@ export default class UpoCloud implements IStorageAdapterV2 {
try { try {
const tempFile = path.join(process.cwd(), 'temp.txt'); const tempFile = path.join(process.cwd(), 'temp.txt');
const createStream = fs.createWriteStream(tempFile); const createStream = fs.createWriteStream(tempFile);
createStream.end(); await waitForStreamClose(createStream);
await this.fileCreate('nc-test-file.txt', { await this.fileCreate('nc-test-file.txt', {
path: tempFile, path: tempFile,
mimetype: '', mimetype: '',

4
packages/nocodb/src/lib/plugins/vultr/Vultr.ts

@ -1,9 +1,9 @@
import fs from 'fs'; import fs from 'fs';
import path from 'path'; import path from 'path';
import AWS from 'aws-sdk'; import AWS from 'aws-sdk';
import { IStorageAdapterV2, XcFile } from 'nc-plugin'; import { IStorageAdapterV2, XcFile } from 'nc-plugin';
import request from 'request'; import request from 'request';
import { waitForStreamClose } from '../../utils/pluginUtils';
export default class Vultr implements IStorageAdapterV2 { export default class Vultr implements IStorageAdapterV2 {
private s3Client: AWS.S3; private s3Client: AWS.S3;
@ -111,7 +111,7 @@ export default class Vultr implements IStorageAdapterV2 {
try { try {
const tempFile = path.join(process.cwd(), 'temp.txt'); const tempFile = path.join(process.cwd(), 'temp.txt');
const createStream = fs.createWriteStream(tempFile); const createStream = fs.createWriteStream(tempFile);
createStream.end(); await waitForStreamClose(createStream);
await this.fileCreate('nc-test-file.txt', { await this.fileCreate('nc-test-file.txt', {
path: tempFile, path: tempFile,
mimetype: '', mimetype: '',

Loading…
Cancel
Save