tableflip/pull-file-reader

Name: pull-file-reader

Owner: TABLEFLIP

Description: Read an HTML5 File object (from e.g. HTML5 drag and drops) as a pull stream source.

Created: 2017-02-09 12:42:43.0

Updated: 2018-04-10 15:01:44.0

Pushed: 2017-05-31 09:07:14.0

Homepage: null

Size: 6

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

pull-file-reader dependencies Status

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

Heavily based on filereader-stream by @maxogden.

install

Use it with npm & browserify

install pull-file-reader

example

drop = require('drag-and-drop-files')
pull = require('pull-stream')
fileReader = require('pull-file-reader')

(document.body, function (files) {
r first = files[0]
ll(
fileReader(first),
pull.collect(function (err, buffs) {
  var contents = Buffer.concat(buffs)
  // contents is the contents of the entire file
})


usage

fileReader = require('pull-file-reader')
source = fileReader(file, [options])

fileReader is a pull stream source.

options:

run the tests

install
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


A (?°?°???TABLEFLIP side project.

js-standard-style


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.