-
Notifications
You must be signed in to change notification settings - Fork 4
/
down.js
21 lines (17 loc) Β· 668 Bytes
/
down.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const url =
'https://w.namu.la/s/849df41483d47c123c134c64c16ebfbea586fc41f9642d8ec4099dc0c8bb007740b0c98bec6c92dff0bea6510e87abbf4c9b005f8ebccbe7d8277672bfa8deabe1680628d3005f40ae0f48ad62022c4fc157395ff5de9e6264c7a03f743f2d17';
// μ μ₯ν μμΉλ₯Ό μ§μ
const savepath = `Pierce.png`;
// μ¬μ© λͺ¨λ μ μ
const https = require('https'); // HTTP λͺ¨λ
const fs = require('fs'); // νμΌ μ²λ¦¬ κ΄λ ¨ λͺ¨λ
// μΆλ ₯ μ§μ
const outfile = fs.createWriteStream(savepath);
// λΉλκΈ°λ‘ URLμ νμΌ λ€μ΄λ‘λ
https.get(url, function (res) {
res.pipe(outfile);
res.on('end', function () {
outfile.close();
console.log('ok');
});
});