https support

This commit is contained in:
manalejandro 2018-07-23 21:45:48 +02:00
parent a08fa4d353
commit cf27817687
2 changed files with 7 additions and 4 deletions

View File

@ -1,7 +1,9 @@
const fs = require('fs'), const fs = require('fs'),
request = require('request'), request = require('request'),
Agent = require('socks5-http-client/lib/Agent'), host = process.argv[2],
host = process.argv[2] Agent = host.match(/https.*/) ?
require('socks5-https-client/lib/Agent') :
require('socks5-http-client/lib/Agent')
fs.readFile(__dirname + '/path.txt', 'utf8', (err, data) => { fs.readFile(__dirname + '/path.txt', 'utf8', (err, data) => {
if (err) console.log(err) if (err) console.log(err)

View File

@ -17,6 +17,7 @@
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"request": "^2.87.0", "request": "^2.87.0",
"socks5-http-client": "^1.0.4" "socks5-http-client": "^1.0.4",
"socks5-https-client": "^1.2.1"
} }
} }