@pittica/google-cloud-storage-helpers 1.3.5 → 1.3.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/dist/scripts.js +2 -2
- package/dist/storage/download.js +1 -1
- package/dist/storage/file.js +2 -2
- package/package.json +3 -3
package/dist/scripts.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
// limitations under the License.
|
|
14
14
|
|
|
15
15
|
const {
|
|
16
|
-
|
|
16
|
+
downloadBucket
|
|
17
17
|
} = require("./storage/download");
|
|
18
18
|
|
|
19
19
|
/**
|
|
@@ -22,4 +22,4 @@ const {
|
|
|
22
22
|
* @param {string} name Bucket name.
|
|
23
23
|
* @param {string} destination Destination path.
|
|
24
24
|
*/
|
|
25
|
-
exports.download = async (name, destination = __dirname) =>
|
|
25
|
+
exports.download = async (name, destination = __dirname) => downloadBucket(name, destination);
|
package/dist/storage/download.js
CHANGED
|
@@ -32,7 +32,7 @@ exports.downloadBucket = async (bucket, destination = __dirname) => {
|
|
|
32
32
|
const [files] = await source.getFiles();
|
|
33
33
|
files.forEach(({
|
|
34
34
|
name
|
|
35
|
-
}) =>
|
|
35
|
+
}) => exports.downloadFile(name, source, destination));
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
/**
|
package/dist/storage/file.js
CHANGED
|
@@ -30,7 +30,7 @@ exports.moveFiles = async (source, destination) => {
|
|
|
30
30
|
const storage = getStorage();
|
|
31
31
|
const bucket = storage.bucket(destination);
|
|
32
32
|
const [files] = await storage.bucket(source).getFiles();
|
|
33
|
-
files.forEach(results => Array.isArray(results) ? results.forEach(file =>
|
|
33
|
+
files.forEach(results => Array.isArray(results) ? results.forEach(file => exports.moveFile(file, bucket)) : exports.moveFile(results, bucket));
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
/**
|
|
@@ -46,7 +46,7 @@ exports.moveFile = async (file, bucket) => {
|
|
|
46
46
|
const source = file.metadata.bucket;
|
|
47
47
|
const destination = bucket.id;
|
|
48
48
|
log.info(`Moving "${id}" from "${source}" to "${destination}"`);
|
|
49
|
-
file.copy(bucket.file(id)).then(() =>
|
|
49
|
+
file.copy(bucket.file(id)).then(() => exports.deleteFile(file) ? log.success(`Moved "${id}" from "${source}" to "${destination}"`) : log.error(`Failed deleted "${id}" in "${source}"`)).catch(() => log.error(`Failed moving "${id}" from "${source}" to "${destination}"`));
|
|
50
50
|
};
|
|
51
51
|
|
|
52
52
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pittica/google-cloud-storage-helpers",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.6",
|
|
5
5
|
"description": "Helpers for Google Cloud Storage.",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"scripts": {
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"homepage": "https://github.com/pittica/google-cloud-storage-helpers#README.md",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@google-cloud/storage": "^7.18.0",
|
|
30
|
-
"@pittica/logger-helpers": "^1.0.
|
|
30
|
+
"@pittica/logger-helpers": "^1.0.5"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@babel/cli": "^7.28.
|
|
33
|
+
"@babel/cli": "^7.28.6",
|
|
34
34
|
"mkdirp": "^3.0.1",
|
|
35
35
|
"prettier": "^3.7.4",
|
|
36
36
|
"rimraf": "^6.1.2",
|