dlw-machine-setup 0.15.0-test.3 → 0.15.0-test.4
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/bin/installer.js +3 -6
- package/package.json +1 -1
package/bin/installer.js
CHANGED
|
@@ -278,9 +278,6 @@ var import_path2 = require("path");
|
|
|
278
278
|
var import_child_process2 = require("child_process");
|
|
279
279
|
var MIN_FILE_SIZE = 1024;
|
|
280
280
|
async function downloadAndExtractAsset(token, asset, projectPath, tempDirName) {
|
|
281
|
-
return downloadAndExtractTgz(token, asset.url, asset.name, projectPath, tempDirName, "application/octet-stream");
|
|
282
|
-
}
|
|
283
|
-
async function downloadAndExtractTgz(token, url, archiveName, projectPath, tempDirName, accept) {
|
|
284
281
|
const tarCheck = (0, import_child_process2.spawnSync)("tar", ["--version"], { stdio: "ignore" });
|
|
285
282
|
if (tarCheck.status !== 0) {
|
|
286
283
|
throw new Error("tar command not found. Please ensure tar is installed and available in your PATH.");
|
|
@@ -297,13 +294,13 @@ async function downloadAndExtractTgz(token, url, archiveName, projectPath, tempD
|
|
|
297
294
|
}
|
|
298
295
|
};
|
|
299
296
|
try {
|
|
300
|
-
const dlRes = await fetchWithRetry(url, {
|
|
301
|
-
headers: { "Accept":
|
|
297
|
+
const dlRes = await fetchWithRetry(asset.url, {
|
|
298
|
+
headers: { "Accept": "application/octet-stream", "Authorization": `Bearer ${token}` }
|
|
302
299
|
});
|
|
303
300
|
if (!dlRes.ok) {
|
|
304
301
|
throw new Error(`Download failed: ${getReadableError(dlRes.status)}`);
|
|
305
302
|
}
|
|
306
|
-
const archivePath = (0, import_path2.join)(tempDir,
|
|
303
|
+
const archivePath = (0, import_path2.join)(tempDir, asset.name);
|
|
307
304
|
(0, import_fs2.writeFileSync)(archivePath, Buffer.from(await dlRes.arrayBuffer()));
|
|
308
305
|
if ((0, import_fs2.statSync)(archivePath).size < MIN_FILE_SIZE) {
|
|
309
306
|
throw new Error("File corrupted");
|