undownload
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

undownload

all in onenode 下载


features 🦕

  • cli 支持
  • 进度条支持
  • httphttps 支持


Usage 🦖

program

install

npm i undownload

basic

基础

import { download } from 'undownload'

// 将输出到工作区的 downloads 目录下
download('https://...')

change outDir

改变输出目录,默认为 downloads

import { download } from 'undownload'

// 将输出到工作区的 downloads/imgs 目录下
download({
    url: 'https://.../foo.jpg',
    outDir: 'downloads/imgs'
})

hide progress bar

隐藏进度条

import { download } from 'undownload'

download({
	url: 'https://...',
	showProgressBar: false
})

dest

返回结果 Promise<string> 输出路径 dest

import { download } from 'undownload'

const runDownload = async () => {
    const dest = await download('https://...')
    
    console.log(dest)
}

runDownload()


cli

install

npm i undownload -g

download

下载,url 支持 httphttps 协议

download <url>

help

帮助

download -h

version

版本号

download -v

method

方法,支持 GETPOST,默认为 GET

download <url> --method POST

outDir

下载后文件的输出目录,默认为 downloads

download <url> --outDir downloads/imgs

showProgressBar

显示进度条,默认为 true

download <url> --showProgressBar false


License

Made with markthree

Published under MIT License.


Package Sidebar

Install

npm i undownload

Weekly Downloads

27

Version

1.0.0

License

MIT

Unpacked Size

19.4 kB

Total Files

12

Last publish

Collaborators

  • markthree