# download-tester

> Remote file downloader/tester with repetitions

Latest version **2.0.0** (published 2017-01-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install download-tester
pnpm add download-tester
yarn add download-tester
bun add download-tester
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2017-01-08 |
| First published | 2016-12-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Luis Antunes |
| Maintainers | luisantunesdeveloper |
| Keywords | tester, download, request, file, stress, download-tester, stresser, mime-types, remote |

## Links

- npm: https://www.npmjs.com/package/download-tester
- Repository: https://github.com/luisantunesdeveloper/download-tester
- Homepage: https://github.com/luisantunesdeveloper/download-tester#readme
- Issues: https://github.com/luisantunesdeveloper/download-tester/issues
- npm.io page: https://npm.io/package/download-tester

## Dependencies (7)

- [chalk](https://npm.io/package/chalk.md) ^1.1.3
- [gauge](https://npm.io/package/gauge.md) ^2.7.2
- [request](https://npm.io/package/request.md) ^2.79.0
- [commander](https://npm.io/package/commander.md) ^2.9.0
- [mime-types](https://npm.io/package/mime-types.md) ^2.1.13
- [request-progress](https://npm.io/package/request-progress.md) ^3.0.0
- [request-multi-streams](https://npm.io/package/request-multi-streams.md) ^0.0.4

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 2.0.0 (latest) — 2017-01-08
- 1.0.1 — 2016-12-31
- 1.0.0 — 2016-12-31
- 0.0.4 — 2016-12-30
- 0.0.3 — 2016-12-30
- 0.0.2 — 2016-12-30
- 0.0.1 — 2016-12-30

## README

# download-tester
## Remote file downloader/tester with repetitions and file download auto-extensions
I did this tool because the available tools like curl are slow when doing something this:  
```
curl -s "http://google.com?[1-1000]"
```  
The above took more than 40 seconds to complete, while with download-tester it took roughly 13 seconds.  
Download-tester downloads each request concurrently. The extension for the downloaded files is automatically appended.

### Install
```
git clone https://github.com/luisantunesdeveloper/download-tester.git
yarn install
```

### Usage

#### 1 - With dependency of dt (download-tester)
```
const req1 = {
    options: {
        url: 'https://cdn.pixabay.com/photo/2014/03/27/21/10/waterfall-299685_1280.jpg'
    },
    numberOfRequests: 10,
    stream: 'fsStream'
};

const req2 = {
    options: {
        url: 'http://www.textfiles.com/fun/acronym.txt'
    },
    numberOfRequests: 10,
    stream: 'stdOutputStream'
};

const emitters = dt.execute([req1, req2]);
```

From the emitters above the following events are available to be listened:  

```
for(let key in emitters) {
    emitters[key].on('response', (response) => {
        emitter.emit('response', {reqNumber: reqNumber, args: args, response: response, stream: stream});
    })
    emitters[key].on('progress', (progress) => {
        emitter.emit('progress', {reqNumber: reqNumber, args: args, progress: progress});
    })
    emitters[key].on('end', () => {
        emitter.emit('end', {reqNumber: reqNumber, args: args});
    })
    emitters[key].on('error', (error) => {
        emitter.emit('error', {reqNumber: reqNumber, args: args, error: error});
    });
}
```
##### Arguments
Since this module uses request-multi-streams module, which in turn wraps request and request-progress, it supports the same options for http get requests.
```
const req2 = {
    options: {
        url: {String}
    },
    progressOptions: {
        throttle: {Number}
        delay: {Number}
    },
    numberOfRequests: {Number},
    stream: {fsStream | stdOutputStream},
    outputDir: {String},
    outputFilename: {String}
};
```
fsStream when outputDir or outputFilename is used and stdOutputStream is not specified.

##### Response
```
{
    reqNumber: {Number},
    args: {Object}, -> The args sent to the request
    progress: {Number}, -> The progress of the requests
    response: {Object}, -> The same as the request.js module
    stream: {Object}, -> Pipeable
    error: {Object}
}
```

#### 2 - With the cli

Usage: cli :  npm run cli dt <url> [numberOfRequests] [options]

  Commands:

    dt [options] <url> [numberOfRequests]

  Tests and downloads the resources pointed by the url.

  Options:

    -h, --help     output usage information
    -V, --version  output the version number
    -d, --dir      set output to the file system with a given directory
    -f, --file     set output to the file system with a given filename
    -s, --std      set output to the standard output stream
```


##### Works with node > 4.x

##### TODO 
- Bulk test/download through the usage of a ".csv" file
- More unit tests

---
_Source: https://npm.io/package/download-tester · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
