当前位置:网站首页>node-fetch下载文件
node-fetch下载文件
2022-06-22 20:50:00 【紫微前端】
var fetch = require("node-fetch");
var fs = require("fs");
function download(u, p) {
return fetch(u, {
method: 'GET',
headers: { 'Content-Type': 'application/octet-stream' },
}).then(res => res.buffer()).then(_ => {
fs.writeFile(p, _, "binary", function (err) {
console.log(err || p);
});
});
}
=======
var url = "https://nodejs.org/dist/v8.9.4/node-v8.9.4-win-x64.zip";
download(url, url.split("/").reverse()[0])边栏推荐
- In the middle of the year, we will promote the integration of worry free, and the value-added package will be reduced by 6
- 2021-04-14
- 2020-12-20
- SqlServer 复制表的自增属性
- 《强化学习周刊》第50期:SafeRL-Kit、GMI-DRL、RP-SDRL & 离线元强化学习
- 2021-04-14
- 2021-08-22
- Redis error reporting and common configurations
- Grafana report display of sentinel based high availability current limiting system
- 2020-12-20
猜你喜欢

C language -- 17 function introduction

NFT can only be viewed from afar, but not blatantly played
Summary of transport layer knowledge points

The method of making videos of knowledge payment system support m3u8 format playback

ArcGIS应用(二十)Arcgis 栅格图像符号系统提示“This dataset does not have valid histogram required for classificati…”

2021-03-06

In the middle of the year, we will promote the integration of worry free, and the value-added package will be reduced by 6
Several ways of redis persistence -- deeply parsing RDB

新捷途X70S上市8.79万起,空间安全越级,不愧是网红国民大7座SUV

Common operations of sourcetree version management
随机推荐
Mysql database DQL query operation
LinkedList source code analysis
Technology cloud report: East to West computing is not only about "computing", but also needs "new storage"
Next permutation [give play to subjective initiative to discover laws]
2021-05-02
A spark app demo
The first warm-up -- implicit type conversion or other?
Valid parentheses
【22暑期复建1】 Codeforces Round #791 (Div. 2)
2020-12-20
5 minutes to quickly launch web applications and APIs (vercel)
Remote access and control - SSH Remote Management and TCP wrappers access control
Lua-- use of data types, variables, loops, functions and operators
2020-12-04
Several soapdatamodules on Delphi soap WebService server side
What are the methods of software stress testing and how to select a software stress testing organization?
2021-04-16
2020-12-04
Cryptography series: certificate format representation of PKI X.509
mysql主从同步及其分库分表基本流程