contentful-export 7.21.76 → 7.21.78
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.
@@ -34,7 +34,8 @@ async function downloadAsset({
|
|
34
34
|
|
35
35
|
// build local file path from the url for the download
|
36
36
|
const parsedUrl = new URL(url);
|
37
|
-
const
|
37
|
+
const decodedPathname = decodeURIComponent(parsedUrl.pathname);
|
38
|
+
const localFile = _path.default.join(directory, parsedUrl.host, decodedPathname);
|
38
39
|
|
39
40
|
// ensure directory exists and create file stream
|
40
41
|
await _fs.promises.mkdir(_path.default.dirname(localFile), {
|
@@ -44,7 +45,7 @@ async function downloadAsset({
|
|
44
45
|
try {
|
45
46
|
// download asset
|
46
47
|
const assetRequest = await httpClient.get(url, {
|
47
|
-
responseType:
|
48
|
+
responseType: 'stream',
|
48
49
|
transformResponse: [data => data]
|
49
50
|
});
|
50
51
|
|
@@ -105,7 +106,7 @@ function downloadAssets(options) {
|
|
105
106
|
httpClient
|
106
107
|
}));
|
107
108
|
}
|
108
|
-
return startingPromise.then(downloadAsset).then(
|
109
|
+
return startingPromise.then(downloadAsset).then(() => {
|
109
110
|
task.output = `${_figures.default.tick} downloaded ${entityName} (${url})`;
|
110
111
|
successCount++;
|
111
112
|
}).catch(error => {
|