No description or website provided.
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
README.md
bundle.js
example.html
example.js
index.js
package.json

README.md

fileliststream

Given a FileList, turn it into a FileListStream.

NPM

Uses filereader-stream to read the individual files in the FileList.

install

Use it with npm & browserify >= 3.0

$ npm install fileliststream

example

const FileListStream = require('fileliststream');
const body = document.body;
const drop = require("drag-and-drop-files");

// make it so console can be piped to.
console.write = function(obj) { console.log(obj.toString()) };

drop(body, function(files) {

  const fileList = FileListStream(event.dataTransfer.files);

  fileList.files.map(function(file) {
     file.pipe(console);
  });

});

usage

FileListStream(fileList, [options])

options can specify output. Possible values are:

  • arraybuffer [default]
  • binary
  • dataurl
  • text

You can also specify chunkSize, default is 8128. This is how many bytes will be read and written at a time to the stream you get back for each file.

You can access the individual FileStreams by index on the FileListStream instance, or directly through the files property, which is a true array.