Giter Club home page Giter Club logo

file-reader's Introduction

Elm HTML5 FileReader bindings

Bindings for the HTML5 file upload control, which is implemented in browsers via the native FileReader class.

FileReader has three main methods (see MDN):

FileReaderInstance.readAsText();
FileReaderInstance.readAsArrayBuffer();
FileReaderInstance.readAsDataURL();

The module also provides helper Elm decoders for change events on <Input type="file"> and drop events, together with a set of examples.

New for Elm 0.18: An additional native code function has been added to enable multipart form uploads of binary data - see http://simonh1000.github.io/2016/12/elm-s3-uploads/

Installation

(sudo) gem install elm_install
<add  "simonh1000/file-reader": "1.0.0 <= v < 2.0.0" to the dependencies section of elm-package.json>
elm-install

A great tool to install native-code based Elm libraries

Manually

Note in particular that you need to add "native-modules": true, to your elm-package.json file as is done in the examples.

examples

If you want to try the examples, you will need to edit src/Native/FileReader.js to replace the comments in the first two lines.

Disclaimer

This project began in the time of 0.16 and was submitted as a library including NativeCode to the elm-package manager. It was never OKed, as was the case with all native code at that time. The native code was subsequently updated by WangBoxue to work with 0.17, and can be used as such. In theory Evan plans to make all browser web APIs available to Elm users and when that includes FileReader, this library will remove the native code.

In the meantime, note that the official guidance would be to use a port rather than a native library such as this. However, you will see that the native code covers the absolute minimum to expose the APIs so I believe this will not jeopardise the stability of your Elm apps.

Simon Hampton, Daniel Bachler

file-reader's People

Contributors

amaksimov avatar danyx23 avatar eriklott avatar felixlam avatar lazamar avatar robashton avatar simonh1000 avatar wangboxue avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.