当前位置:网站首页>Node fetch download file
Node fetch download file
2022-06-23 00:45:00 【Ziwei front end】
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])边栏推荐
- Kunlun distributed database sequence function and its implementation mechanism
- Kunlundb query optimization (I)
- [machine learning watermelon book] update challenge [Day1]: 1.1 INTRODUCTION
- 百度交易中台之钱包系统架构浅析
- OSPF综合实验
- Several abnormal scenarios of things system
- 62. 不同路径
- #yyds干货盘点# 解决剑指offer:把二叉树打印成多行
- SAP UI5 应用开发教程之一百零三 - 如何在 SAP UI5 应用中消费第三方库
- How Huawei cloud implements a global low delay network architecture for real-time audio and video [Part 1]
猜你喜欢

OSPF comprehensive experiment

cadence SPB17.4 - allegro - 优化指定单条电气线折线连接角度 - 折线转圆弧

2022 TIANTI match - National Finals rematch

SAP UI5 应用开发教程之一百零二 - SAP UI5 应用的打印(Print)功能实现详解试读版

【机器学习-西瓜书】更文挑战【Day1】:1.1 引言

cadence SPB17.4 - 中文UI设置

Sélecteur de hiérarchie

SAP MM 事务代码VL04为STO创建外向交货单

二叉树转字符串及字符串转二叉树

SAP ui5 application development tutorial 103 - how to consume third-party libraries in SAP ui5 applications
随机推荐
Ros2 summer school 2022 transfer-
数据库中数据的储存结构和方式是什么?
【UVM】别再说你的 VIP 用不了 RAL Model
MGRE环境下的OSPF实验
“听觉”营销价值凸显,喜马拉雅迎来新局点
Typecho仿盧松松博客主題模板/科技資訊博客主題模板
LeetCode刷题——715. Range 模块
Quelle est la structure et la façon dont les données sont stockées dans la base de données?
最安全的现货白银的心理分析
你踩过这些坑吗?谨慎在时间类型列上创建索引
掘地三尺搞定 Redis 与 MySQL 数据一致性问题
华为云招募工业智能领域合作伙伴,强力扶持+商业变现
贵金属现货白银如何呢?
SAP ui5 application development tutorial 102 - detailed trial version of print function implementation of SAP ui5 application
二叉树转字符串及字符串转二叉树
Learn the specific technical learning experience of designing reusable software from the three levels of class, API and framework
flowable 全局监听 监听流程的启动和流程的结束
How to get started with machine learning?
每日刷题记录 (一)
Swiftui swift tutorial 14 useful array operators