@rowengine/common 1.1.5 → 1.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/utils/gc.d.ts +1 -0
- package/build/utils/gc.js +11 -1
- package/package.json +1 -1
package/build/utils/gc.d.ts
CHANGED
|
@@ -8,5 +8,6 @@ interface UploadFileToGCSResponse {
|
|
|
8
8
|
}
|
|
9
9
|
export declare const uploadFileToGCS: ({ filePath, gcsFilePath, }: UploadFileToGCS) => Promise<UploadFileToGCSResponse>;
|
|
10
10
|
export declare const uploadFolderToGCS: (folderPath: string, gcsPath: string) => Promise<void>;
|
|
11
|
+
export declare const getFilesFromGCSFolder: (gcsFolderPath: string) => Promise<string[]>;
|
|
11
12
|
export declare const downloadProjectFileFromGCS: (projectId: string, fileName: string, destinationPath: string) => Promise<string | null>;
|
|
12
13
|
export {};
|
package/build/utils/gc.js
CHANGED
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.downloadProjectFileFromGCS = exports.uploadFolderToGCS = exports.uploadFileToGCS = void 0;
|
|
15
|
+
exports.downloadProjectFileFromGCS = exports.getFilesFromGCSFolder = exports.uploadFolderToGCS = exports.uploadFileToGCS = void 0;
|
|
16
16
|
const gc_storage_1 = __importDefault(require("./gc-storage"));
|
|
17
17
|
const path_1 = __importDefault(require("path"));
|
|
18
18
|
const fs_1 = __importDefault(require("fs"));
|
|
@@ -60,6 +60,16 @@ const uploadFolderToGCS = (folderPath, gcsPath) => __awaiter(void 0, void 0, voi
|
|
|
60
60
|
const res = yield Promise.all(promises);
|
|
61
61
|
});
|
|
62
62
|
exports.uploadFolderToGCS = uploadFolderToGCS;
|
|
63
|
+
const getFilesFromGCSFolder = (gcsFolderPath) => __awaiter(void 0, void 0, void 0, function* () {
|
|
64
|
+
const options = {
|
|
65
|
+
prefix: gcsFolderPath.endsWith('/')
|
|
66
|
+
? gcsFolderPath
|
|
67
|
+
: gcsFolderPath + '/',
|
|
68
|
+
};
|
|
69
|
+
const [files] = yield gc_storage_1.default.getFiles(options);
|
|
70
|
+
return files.map((file) => file.name);
|
|
71
|
+
});
|
|
72
|
+
exports.getFilesFromGCSFolder = getFilesFromGCSFolder;
|
|
63
73
|
const downloadProjectFileFromGCS = (projectId, fileName, destinationPath) => __awaiter(void 0, void 0, void 0, function* () {
|
|
64
74
|
const gcFilePath = `projects/${projectId}/${fileName}`;
|
|
65
75
|
const gcFile = gc_storage_1.default.file(gcFilePath);
|