Skip to content

Commit

Permalink
docs(readme): update with await
Browse files Browse the repository at this point in the history
  • Loading branch information
mborne committed Jun 10, 2024
1 parent 4f4382d commit 36c53c1
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,19 @@

[![Node.js CI](https://github.com/mborne/node-dl/actions/workflows/node.js.yml/badge.svg)](https://github.com/mborne/node-dl/actions/workflows/node.js.yml) [![Coverage Status](https://coveralls.io/repos/github/mborne/node-dl/badge.svg?branch=master)](https://coveralls.io/github/mborne/node-dl?branch=master)

## Description

Download file from a given `sourceUrl` to a `targetPath`.

Note that :

* It relies on `wget` to simplify FTP downloads
* A temp file `{targetPath}.part` is created while downloading to handle download interuptions
Download file from a given `sourceUrl` to a `targetPath` with `wget`.

## Usage

```js
const download = require('@mborne/dl');

download({
/*
* Note that a temp file `{targetPath}.part` is created while downloading to handle download interuptions
*/
const targetPath = await download({
sourceUrl: 'https://github.com/mborne.keys',
targetPath: '/tmp/mborne.keys'
}).then(function(targetPath){
console.log(targetPath);
}).catch(function(err){
console.log(err.message);
});
```

Expand Down

0 comments on commit 36c53c1

Please sign in to comment.