Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/alsotang/simpledownload

A Node.js download package(library)
https://github.com/alsotang/simpledownload

Last synced: 2 months ago
JSON representation

A Node.js download package(library)

Awesome Lists containing this project

README

        

[![Node.js CI](https://github.com/alsotang/simpledownload/actions/workflows/node.js.yml/badge.svg)](https://github.com/alsotang/simpledownload/actions/workflows/node.js.yml)

## Install

`npm install simpledownload`

## Usage

```js
import {simpledownload} from 'simpledownload'
await simpledownload('https://www.google.co.jp/images/srpr/logo11w.png', `${__dirname}/1.jpg`);
```

### simpledownload(url: string, localPath: string, options?: {timeout, agent}): Promise\

* `url` - the url you wanna download. e.g `https://www.google.co.jp/images/srpr/logo11w.png`
* `localPath` - e.g `` `${__dirname}/1.jpg` ``
* `options.timeout` - use millisecond. If timeout, `err.timeout` would exist.
* `options.agent` - `http.Agent`. For example, you can use `node-socks-proxy-agent` to enable socks5 proxy.

## dev

1. `$ npm run test`
2. bump package.json version
3. `$ npm publish`

## license

MIT