feat: update wget.ts
This commit is contained in:
@@ -40,8 +40,8 @@
|
|||||||
},
|
},
|
||||||
"wget.ts": {
|
"wget.ts": {
|
||||||
"script_name": "wget.ts",
|
"script_name": "wget.ts",
|
||||||
"script_length": 3789,
|
"script_length": 3909,
|
||||||
"script_sha256": "a5e72e6a86b2aa7a9f9fbe1e89e62100391b86ce11022e10e803c1816ace2f06",
|
"script_sha256": "3f9b61749f9db5d18e2a6ec29cc65f5209ff1c34db0711a4083b07432bebc562",
|
||||||
"script_full_url": "https://git.hatter.ink/hatter/ts-scripts/raw/branch/main/single-scripts/wget.ts",
|
"script_full_url": "https://git.hatter.ink/hatter/ts-scripts/raw/branch/main/single-scripts/wget.ts",
|
||||||
"single_script_file": true
|
"single_script_file": true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ function getEnvironmentProxy(): string | undefined {
|
|||||||
|
|
||||||
const args = Deno.args;
|
const args = Deno.args;
|
||||||
const flags = parseArgs(Deno.args, {
|
const flags = parseArgs(Deno.args, {
|
||||||
boolean: ["help"],
|
boolean: ["help", "no-proxy"],
|
||||||
string: ["proxy", "output"],
|
string: ["proxy", "output"],
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ if (args.length === 0) {
|
|||||||
if (flags.help) {
|
if (flags.help) {
|
||||||
console.log(`wget.ts - download file
|
console.log(`wget.ts - download file
|
||||||
|
|
||||||
wget.ts <URL>`);
|
wget.ts [--proxy socks5h://ip:port] [--no-proxy] [--output filename] <URL>`);
|
||||||
Deno.exit(0);
|
Deno.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,8 +102,9 @@ const stateFileInterVal = setInterval(async () => {
|
|||||||
const outputFileWritable = Deno.createSync(outputFilename).writable;
|
const outputFileWritable = Deno.createSync(outputFilename).writable;
|
||||||
|
|
||||||
let init = undefined;
|
let init = undefined;
|
||||||
|
const noProxy = flags["no-proxy"];
|
||||||
const proxy = flags.proxy || getEnvironmentProxy();
|
const proxy = flags.proxy || getEnvironmentProxy();
|
||||||
if (proxy) {
|
if (proxy && !noProxy) {
|
||||||
console.log(`Using proxy: ${proxy}`);
|
console.log(`Using proxy: ${proxy}`);
|
||||||
init = {
|
init = {
|
||||||
client: Deno.createHttpClient({
|
client: Deno.createHttpClient({
|
||||||
|
|||||||
Reference in New Issue
Block a user