Updated format of update.js

This commit is contained in:
Zakary Timson 2022-02-10 03:25:22 +00:00
parent 62f29285b3
commit c69c1c954a

View File

@ -2,9 +2,9 @@
* Automatically download all the scripts in the repository. * Automatically download all the scripts in the repository.
*/ */
export async function main(ns) { export async function main(ns) {
const SRC = 'https://gitlab.zakscode.com/ztimson/BitBurner/-/raw/develop/scripts/'; const src = 'https://gitlab.zakscode.com/ztimson/BitBurner/-/raw/develop/scripts/';
const DIST = '/scripts/'; const dist = '/scripts/';
const FILE_LIST = [ const fileList = [
'auto-pwn.js', 'auto-pwn.js',
'bruteforce.js', 'bruteforce.js',
'crawler.js', 'crawler.js',
@ -15,11 +15,11 @@ export async function main(ns) {
// Download each file // Download each file
ns.tprint("Downloading scripts:"); ns.tprint("Downloading scripts:");
for(const FILE of FILE_LIST) { for(const file of fileList) {
await ns.sleep(500); await ns.sleep(500);
await ns.wget(`${SRC}${FILE}`, `${DIST}${FILE}`); await ns.wget(`${src}${file}`, `${dist}${file}`);
const SPEED = ~~((Math.random() * 200) + 100) / 10; const speed = ~~((Math.random() * 200) + 100) / 10;
ns.tprint(`${FILE} ${FILE.length <= 10 ? '\t' : ''}\t [==================>] 100% \t (${SPEED} MB/s)`); ns.tprint(`${file} ${file.length <= 10 ? '\t' : ''}\t [==================>] 100% \t (${speed} MB/s)`);
} }
ns.tprint('Done!'); ns.tprint('Done!');
} }