@alwaysmeticulous/downloading-helpers 2.141.2 → 2.143.0
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.
|
@@ -12,9 +12,14 @@ export declare const downloadFile: (fileUrl: string, path: string, opts?: {
|
|
|
12
12
|
/**
|
|
13
13
|
* Download a file from a URL and extract it to a directory.
|
|
14
14
|
* The zip file will be deleted after extraction, keeping only the extracted files.
|
|
15
|
+
* __Warning__: this function is not thread safe.
|
|
15
16
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
17
|
+
* @param fileUrl The URL of the file to download.
|
|
18
|
+
* @param tmpZipFilePath The path to save the downloaded file. Do not try downloading a file to a
|
|
19
|
+
* `tmpZipFilePath` that may already be in use by another process b/c this can corrupt the data.
|
|
20
|
+
* @param extractPath The path to a directory which we will extract files from a gzip into.
|
|
21
|
+
* Do not try extracting to a dir that may already be in use by another process b/c overlapping
|
|
22
|
+
* file names can cause data corruption.
|
|
23
|
+
* @returns The list of the extracted files.
|
|
19
24
|
*/
|
|
20
25
|
export declare const downloadAndExtractFile: (fileUrl: string, tmpZipFilePath: string, extractPath: string) => Promise<string[]>;
|
|
@@ -72,22 +72,27 @@ exports.downloadFile = downloadFile;
|
|
|
72
72
|
/**
|
|
73
73
|
* Download a file from a URL and extract it to a directory.
|
|
74
74
|
* The zip file will be deleted after extraction, keeping only the extracted files.
|
|
75
|
+
* __Warning__: this function is not thread safe.
|
|
75
76
|
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
77
|
+
* @param fileUrl The URL of the file to download.
|
|
78
|
+
* @param tmpZipFilePath The path to save the downloaded file. Do not try downloading a file to a
|
|
79
|
+
* `tmpZipFilePath` that may already be in use by another process b/c this can corrupt the data.
|
|
80
|
+
* @param extractPath The path to a directory which we will extract files from a gzip into.
|
|
81
|
+
* Do not try extracting to a dir that may already be in use by another process b/c overlapping
|
|
82
|
+
* file names can cause data corruption.
|
|
83
|
+
* @returns The list of the extracted files.
|
|
79
84
|
*/
|
|
80
|
-
const downloadAndExtractFile = async (fileUrl,
|
|
81
|
-
await (0, exports.downloadFile)(fileUrl,
|
|
85
|
+
const downloadAndExtractFile = async (fileUrl, tmpZipFilePath, extractPath) => {
|
|
86
|
+
await (0, exports.downloadFile)(fileUrl, tmpZipFilePath);
|
|
82
87
|
const entries = [];
|
|
83
88
|
try {
|
|
84
|
-
await (0, extract_zip_1.default)(
|
|
89
|
+
await (0, extract_zip_1.default)(tmpZipFilePath, {
|
|
85
90
|
dir: extractPath,
|
|
86
91
|
onEntry: (entry) => entries.push(entry.fileName),
|
|
87
92
|
});
|
|
88
93
|
}
|
|
89
94
|
finally {
|
|
90
|
-
await (0, promises_1.rm)(
|
|
95
|
+
await (0, promises_1.rm)(tmpZipFilePath);
|
|
91
96
|
}
|
|
92
97
|
return entries;
|
|
93
98
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"download-file.js","sourceRoot":"","sources":["../../src/file-downloads/download-file.ts"],"names":[],"mappings":";;;;;;AAAA,2BAAmD;AACnD,0CAAiC;AACjC,mCAA0C;AAC1C,+BAAiC;AACjC,kDAA0B;AAC1B,8DAAqC;AACrC,8DAAkC;AAElC,MAAM,mBAAmB,GAAG,IAAA,gBAAS,EAAC,iBAAQ,CAAC,CAAC;AAEhD;;;;GAIG;AACI,MAAM,YAAY,GAAG,KAAK,EAC/B,OAAe,EACf,IAAY,EACZ,OAKI,EAAE,EACS,EAAE;;IACjB,gGAAgG;IAChG,MAAM,oBAAoB,GAAG,MAAA,IAAI,CAAC,oBAAoB,mCAAI,KAAM,CAAC;IACjE,MAAM,2BAA2B,GAC/B,MAAA,IAAI,CAAC,2BAA2B,mCAAI,MAAO,CAAC;IAC9C,MAAM,yBAAyB,GAAG,MAAA,IAAI,CAAC,yBAAyB,mCAAI,CAAC,CAAC;IACtE,MAAM,yBAAyB,GAAG,MAAA,IAAI,CAAC,yBAAyB,m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,CAAC,EAAE;YACnC,MAAM,GAAG,CAAC;SACX;QAED,sCAAsC;QACtC,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAC5B,UAAU,CAAC,OAAO,EAAE,yBAAyB,CAAC,CAC/C,CAAC;QACF,MAAM,IAAA,oBAAY,EAAC,OAAO,EAAE,IAAI,EAAE;YAChC,oBAAoB;YACpB,2BAA2B;YAC3B,yBAAyB,EAAE,yBAAyB,GAAG,CAAC;SACzD,CAAC,CAAC;KACJ;AACH,CAAC,CAAC;AApEW,QAAA,YAAY,gBAoEvB;AAEF;;;;;;;;;;;;GAYG;AACI,MAAM,sBAAsB,GAIV,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,EAAE;IACtE,MAAM,IAAA,oBAAY,EAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IAC5C,MAAM,OAAO,GAAa,EAAE,CAAC;IAE7B,IAAI;QACF,MAAM,IAAA,qBAAO,EAAC,cAAc,EAAE;YAC5B,GAAG,EAAE,WAAW;YAChB,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;SACjD,CAAC,CAAC;KACJ;YAAS;QACR,MAAM,IAAA,aAAE,EAAC,cAAc,CAAC,CAAC;KAC1B;IAED,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAlBW,QAAA,sBAAsB,0BAkBjC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alwaysmeticulous/downloading-helpers",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.143.0",
|
|
4
4
|
"description": "Helper utilities for downloading files & scripts required to execute replays",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@alwaysmeticulous/api": "^2.141.0",
|
|
24
|
-
"@alwaysmeticulous/client": "^2.
|
|
25
|
-
"@alwaysmeticulous/common": "^2.
|
|
24
|
+
"@alwaysmeticulous/client": "^2.143.0",
|
|
25
|
+
"@alwaysmeticulous/common": "^2.143.0",
|
|
26
26
|
"axios": "^1.2.6",
|
|
27
27
|
"axios-retry": "^4.1.0",
|
|
28
28
|
"extract-zip": "^2.0.1",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"jest": {
|
|
56
56
|
"preset": "../../jest.config.js"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "cbc37a5e356a01730d48a524757e141b408a0495"
|
|
59
59
|
}
|