Skip to content

Commit

Permalink
Updated script
Browse files Browse the repository at this point in the history
  • Loading branch information
JrMasterModelBuilder committed Dec 28, 2024
1 parent 00b5c27 commit 653c375
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions bin/download-harman-air-runtime.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,22 @@ import {runtimes, userAgent} from '../util/harman.mjs';
import {download} from '../util/download.mjs';
import {Hasher, Counter, Void} from '../util/stream.mjs';
import {queue} from '../util/queue.mjs';
import {
createPackageUrl,
groupFilesCaching,
groupForSha256,
pathForFile
} from '../util/ia.mjs';
import {createFileUrl, groupFilesCaching, groupPath} from '../util/ia.mjs';
import {Progress} from '../util/tui.mjs';
import {directory} from '../util/packages.mjs';

async function main() {
// eslint-disable-next-line no-process-env
const downloadThreads = +process.env.SHOCKPKG_DOWNLOAD_THREADS || 4;
// eslint-disable-next-line no-process-env
const backupThreads = +process.env.SHOCKPKG_BACKUP_THREADS || 4;
const backupThreads = +process.env.SHOCKPKG_BACKUP_THREADS || 1;

const args = process.argv.slice(2);
if (args.length < 1) {
throw new Error('Args: outdir [backup]');
if (args.length < 2) {
throw new Error('Args: outdir suffix [backup]');
}

const [outdir, backup] = args;
const [outdir, suffix, backup] = args;

const resources = (await runtimes()).map(info => ({
info,
Expand Down Expand Up @@ -126,21 +121,22 @@ async function main() {
console.log('-'.repeat(80));

for (const {
info: {name, file, group},
info,
size,
hashes: {sha256, sha1, md5}
} of resources) {
const group = [...info.group, suffix].join('-');
const pkg = {
name,
file,
name: info.name,
file: info.file,
size,
sha256,
sha1,
md5,
source: createPackageUrl(sha256, file)
source: createFileUrl(group, groupPath(sha256, info.file))
};
const json = JSON.stringify(pkg, null, '\t');
const f = pathJoin(...group, `${name}.json`);
const f = pathJoin(...info.group, `${info.name}.json`);

console.log(f);
console.log(json);
Expand All @@ -159,8 +155,8 @@ async function main() {

const each = async resource => {
const {info, file, hashes} = resource;
const path = pathForFile(hashes.sha256, info.file);
const group = groupForSha256(hashes.sha256);
const group = [...info.group, suffix].join('-');
const path = groupPath(hashes.sha256, info.file);

try {
const m = await metadata(group);
Expand Down

0 comments on commit 653c375

Please sign in to comment.