@alwaysmeticulous/downloading-helpers
Advanced tools
Comparing version 2.129.1 to 2.130.0
@@ -7,2 +7,3 @@ "use strict"; | ||
exports.fetchAsset = void 0; | ||
const fs_1 = require("fs"); | ||
const promises_1 = require("fs/promises"); | ||
@@ -52,9 +53,4 @@ const path_1 = require("path"); | ||
} | ||
let contents = (await client.get(urlToDownloadFrom)).data; | ||
if (typeof contents !== "string") { | ||
// axios sometimes returns an object if the response body is JSON, as is the case for | ||
// instance when the asset we requested was a source map | ||
contents = JSON.stringify(contents); | ||
} | ||
await (0, promises_1.writeFile)(filePath, contents); | ||
const contentStream = (await client.get(urlToDownloadFrom, { responseType: "stream" })).data; | ||
await contentStream.pipe((0, fs_1.createWriteStream)(filePath)); | ||
if (entry) { | ||
@@ -61,0 +57,0 @@ logger.debug(`${urlToDownloadFrom} updated`); |
{ | ||
"name": "@alwaysmeticulous/downloading-helpers", | ||
"version": "2.129.1", | ||
"version": "2.130.0", | ||
"description": "Helper utilities for downloading files & scripts required to execute replays", | ||
@@ -54,3 +54,3 @@ "license": "ISC", | ||
}, | ||
"gitHead": "1a184f9517a0a3e283ac25a3dacee78e2288c3c2" | ||
"gitHead": "019e72e5b6c922abe5e94763b3434b8e25a27979" | ||
} |
Sorry, the diff of this file is not supported yet
46014
542
9