2022-09-08 21:40:48 +02:00
|
|
|
const http = require("https")
|
|
|
|
const fs = require("fs")
|
2022-01-16 23:41:33 +01:00
|
|
|
|
|
|
|
// Could use yargs to have more validation but wanted to keep it simple
|
2022-09-08 21:40:48 +02:00
|
|
|
const args = process.argv.slice(2)
|
|
|
|
const FILE_URL = args[0]
|
|
|
|
const DESTINATION = args[1]
|
2022-01-16 23:41:33 +01:00
|
|
|
|
|
|
|
console.log(`Downloading ${FILE_URL} to ${DESTINATION}`)
|
|
|
|
|
2022-09-08 21:40:48 +02:00
|
|
|
const file = fs.createWriteStream(DESTINATION)
|
|
|
|
http.get(FILE_URL, (response) => response.pipe(file))
|