feat: update wget.ts

This commit is contained in:
2025-01-19 13:27:15 +08:00
parent e5a2977162
commit 294d523039
2 changed files with 6 additions and 5 deletions

View File

@@ -40,8 +40,8 @@
},
"wget.ts": {
"script_name": "wget.ts",
"script_length": 3789,
"script_sha256": "a5e72e6a86b2aa7a9f9fbe1e89e62100391b86ce11022e10e803c1816ace2f06",
"script_length": 3909,
"script_sha256": "3f9b61749f9db5d18e2a6ec29cc65f5209ff1c34db0711a4083b07432bebc562",
"script_full_url": "https://git.hatter.ink/hatter/ts-scripts/raw/branch/main/single-scripts/wget.ts",
"single_script_file": true
}

View File

@@ -51,7 +51,7 @@ function getEnvironmentProxy(): string | undefined {
const args = Deno.args;
const flags = parseArgs(Deno.args, {
boolean: ["help"],
boolean: ["help", "no-proxy"],
string: ["proxy", "output"],
});
@@ -62,7 +62,7 @@ if (args.length === 0) {
if (flags.help) {
console.log(`wget.ts - download file
wget.ts <URL>`);
wget.ts [--proxy socks5h://ip:port] [--no-proxy] [--output filename] <URL>`);
Deno.exit(0);
}
@@ -102,8 +102,9 @@ const stateFileInterVal = setInterval(async () => {
const outputFileWritable = Deno.createSync(outputFilename).writable;
let init = undefined;
const noProxy = flags["no-proxy"];
const proxy = flags.proxy || getEnvironmentProxy();
if (proxy) {
if (proxy && !noProxy) {
console.log(`Using proxy: ${proxy}`);
init = {
client: Deno.createHttpClient({