# filereader-stream

> Read an HTML5 File object (from e.g. HTML5 drag and drops) as a stream.

Latest version **2.0.0** (published 2018-05-03) · BSD-2-Clause license · 0 weekly downloads

## Install

```sh
npm install filereader-stream
pnpm add filereader-stream
yarn add filereader-stream
bun add filereader-stream
```

## 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 | 2018-05-03 |
| First published | 2013-12-20 |
| Weekly downloads | 0 |
| License | BSD-2-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 5.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 102 |
| Author | max ogden |
| Maintainers | brianloveswords, jekrb, maxogden |

## Links

- npm: https://www.npmjs.com/package/filereader-stream
- Repository: https://github.com/maxogden/filereader-stream
- Issues: https://github.com/maxogden/filereader-stream/issues
- npm.io page: https://npm.io/package/filereader-stream

## Dependencies (2)

- [from2](https://npm.io/package/from2.md) ^2.1.0
- [typedarray-to-buffer](https://npm.io/package/typedarray-to-buffer.md) ^3.0.4

## Recent versions

- 2.0.0 (latest) — 2018-05-03
- 1.0.0 — 2015-11-01
- 0.2.0 — 2014-12-11
- 0.1.1 — 2014-04-16
- 0.1.0 — 2014-02-21
- 0.0.1 — 2013-12-20

## README

# filereader-stream

Given an HTML5 File object (from e.g. HTML5 drag and drops), turn it into a readable stream.


# install

Use it with npm & [browserify](/substack/node-browserify)

```bash
$ npm install filereader-stream
```

# example
```js
var drop = require('drag-and-drop-files')
var concat = require('concat-stream')
var fileReaderStream = require('filereader-stream')

test('should read file when one is dropped', function(t) {
  drop(document.body, function(files) {
    var first = files[0]
    fileReaderStream(first).pipe(concat(function(contents) {
      // contents is the contents of the entire file
    }))
  })
})
```

# usage

```js
var fileReaderStream = require('filereader-stream')
var readStream = fileReaderStream(file, [options])
```

`fileReaderStream` is a Streams 2 Readable Stream, so you can do all the streamy things with it like `.pipe` etc.

`options`:

* `chunkSize` - default `1024 * 1024` (1MB) - How many bytes will be read at a time
* `offset` - default `0` - Where in the file to start reading

# run the tests

```
npm install
npm test
```

then open your browser to the address provided, open your JS console, and drag and drop files onto the page until the test suite passes/fails

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