当前位置:网站首页>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])边栏推荐
- Task management of embedded development foundation (thread management)
- Mysql database design
- What are the methods of software stress testing and how to select a software stress testing organization?
- Help customers' digital transformation and build a new operation and maintenance system
- Developing salary management system based on C language course paper + source code and executable EXE file
- Dragon City in Europe | National Geographic the most romantic and safe destination in the world
- Spark SQL 访问json和jdbc数据源
- Codeup longest palindrome substring
- Summary of transport layer knowledge points
- Plan and change of continuous repair
猜你喜欢

The relationship between derivative and differential of function

Spark RDD Programming Guide(2.4.3)

2021-08-26
Learn redis with you (11) -- redis distributed lock

2021-04-05

c语言---17 函数简介

Three cache methods and principles
Task cache compilation caused by gradle build cache

Introduction to database access tools

In the third week of June, the main growth ranking list (BiliBili platform) of station B single feigua data up was released!
随机推荐
2020-12-20
Three cache methods and principles
Help customers' digital transformation and build a new operation and maintenance system
MySQL multi table operation exercise
Greedy interval problem (2)
Why is yuancosmos so popular? Is the 10trillion yuan shouted by the market boasting or the truth?
Cryptography series: certificate format representation of PKI X.509
LinkedList source code analysis
Common operations of sourcetree version management
Case 2 of SQL performance degradation caused by modifying implicit parameters
The relationship between derivative and differential of function
2021-03-06
Lua -- iterator, module, meta table
A group of K overturned linked lists [disassembly / overturning / assembly of linked lists]
Spark SQL Start(2.4.3)
Half optimized SQL
Next permutation [give play to subjective initiative to discover laws]
2021-04-16
Several methods of changing 91 Oracle common table into partitioned table
In the middle of the year, we will promote the integration of worry free, and the value-added package will be reduced by 6