filereader-stream
Read an HTML5 File object (from e.g. HTML5 drag and drops) as a stream.
Last updated 8 years ago by jekrb .
BSD-2-Clause · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install filereader-stream 
SYNC missed versions from official npm registry.

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

$ npm install filereader-stream

example

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

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

Current Tags

  • 2.0.0                                ...           latest (8 years ago)

6 Versions

  • 2.0.0                                ...           8 years ago
  • 1.0.0                                ...           10 years ago
  • 0.2.0                                ...           11 years ago
  • 0.1.1                                ...           12 years ago
  • 0.1.0                                ...           12 years ago
  • 0.0.1                                ...           12 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (2)
Dev Dependencies (6)
Dependents (2)

Copyright 2013 - present © cnpmjs.org | Home |