Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including @webacad/observable-file-reader with all npm packages installed. Try it out:

require("rxjs/package.json"); // rxjs is a peer dependency. var observableFileReader = require("@webacad/observable-file-reader")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@webacad/observable-file-reader v0.2.0

Read file inputs with rxjs observables

NPM version Build Status

WebACAD/ObservableFileReader

Read file inputs with rxjs observables.

Dependencies

  • rxjs

Installation

$ npm install --save @webacad/observable-file-reader

or with yarn

$ yarn add @webacad/observable-file-reader

Usage

import {readFileAsDataURL} from '@webacad/observable-file-reader';

const file = (<HTMLInputElement>document.querySelector('#myFileInput')).files[0];

readFileAsDataURL(file).subscribe((data: string) => {
    console.log('done');
    console.log(data);
});

Available functions

  • readFileAsDataURL: same as FileReader.readAsDataURL
  • readFileAsBase64: same as readFileAsDataURL function but strips the base64 url prefix
  • readFileInChunksAsDataURL: same as readFileAsDataURL function, but emitted in chunks
  • readFileInChunksAsBase64: same as readFileAsBase64 function, but emitted in chunks
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free