New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

filereader-stream

Package Overview
Dependencies
Maintainers
3
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

filereader-stream

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

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.1K
decreased by-13.69%
Maintainers
3
Weekly downloads
 
Created
Source

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

FAQs

Package last updated on 03 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc