# stream-to-file

> Writes remote streams to local files.

Latest version **2.0.1** (published 2017-05-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install stream-to-file
pnpm add stream-to-file
yarn add stream-to-file
bun add stream-to-file
```

Provides the command `stream-to-file`.

## 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.1 |
| Published | 2017-05-22 |
| First published | 2016-12-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Alberto Miranda |
| Maintainers | codealchemist |
| Keywords | audio, recorder, remote |

## Links

- npm: https://www.npmjs.com/package/stream-to-file
- Repository: https://github.com/codealchemist/stream-to-file
- Homepage: https://github.com/codealchemist/stream-to-file#readme
- Issues: https://github.com/codealchemist/stream-to-file/issues
- npm.io page: https://npm.io/package/stream-to-file

## Dependencies (2)

- [request](https://npm.io/package/request.md) ^2.79.0
- [pretty-bytes](https://npm.io/package/pretty-bytes.md) ^4.0.2

## Recent versions

- 2.0.1 (latest) — 2017-05-22
- 2.0.0 — 2017-05-22
- 1.0.2 — 2017-03-03
- 1.0.0 — 2016-12-06

## README

# stream-to-file
Writes remote streams to local files.


## Install

For CLI usage you should do a global install:

`npm install -g stream-to-file`

For programatic usage in your project:

`npm install --save stream-to-file`


## CLI usage
`stream-to-file [url] [outputFile] [[time]]`

- *url:* The url with the audio stream.
- *outputFile:* The file where you want to write audio to.
- *time:* Optional. Recording will stop after this amount of time.
  If not specified recoding will continue until the `ctrl+c` is pressed.
  Format: `HH:mm`
  Example: `0:10` (stop after 10 minutes)


## Programatic usage
```javascript
const StreamToFile = require('stream-to-file')
const downloader = new StreamToFile({
  url: 'http://19353.live.streamtheworld.com:3690/977_90_SC',
  file: './test.mp3',
  time: '0:01'
})

downloader
  .onDone((data) => {
    console.log('DOWNLOAD COMPLETED!', data)
  })
  .onInvalidTime(() => {
    console.error('  - Invalid time. Cancel recording with ctrl+c.')
  })
  .download()
```


## Test

If you clone this repo and want to test your code changes just run:
`npm test`

Then try running the sample implementation:
`node test.js`

Have fun!

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