【文件属性】:
文件名称:下载:下载并解压缩文件
文件大小:6KB
文件格式:ZIP
更新时间:2021-02-03 17:02:06
nodejs http stream async download
下载
下载并解压缩文件
有关命令行版本,请参见 。
安装
$ npm install download
用法
const fs = require ( 'fs' ) ;
const download = require ( 'download' ) ;
( async ( ) => {
await download ( 'http://unicorn.com/foo.jpg' , 'dist' ) ;
fs . writeFileSync ( 'dist/foo.jpg' , await download ( 'http://unicorn.com/foo.jpg' ) ) ;
download ( 'unicorn.com/foo.jpg' ) . pipe ( fs . createWriteStream ( 'dist/foo.jpg' ) ) ;
await Promise . all ( [
'unicorn.com/foo.jpg' ,
'cats.com/dancing.gif'
] . map ( url => download ( url , 'd
【文件预览】:
download-master
----.gitignore(23B)
----package.json(923B)
----.npmrc(19B)
----.travis.yml(45B)
----index.js(2KB)
----fixture.zip(166B)
----test.js(4KB)
----license(1KB)
----readme.md(2KB)
----.gitattributes(19B)
----.editorconfig(175B)