JSPM

react-file-base64

1.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3780
  • Score
    100M100P100Q119198F
  • License MIT

React Component for Converting File to base64

Package Exports

  • react-file-base64

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-file-base64) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

React File Base64

React Component for Converting Files to base64. It's based on Dev Mozilla Website

DEMO

Install

You can import react-file-base64.js to your react component file like this and process it with your preprocessor.

You can install it via NPM

npm install react-file-base64

Usage

import React from 'react';
import ReactDOM from 'react-dom';

import FileBase64 from 'react-file-base64';

class App extends React.Component {

  constructor() {
    super()
    this.state = {
      files: []
    }
  }

  // Callback~
  getFiles(files){
    this.setState({ files: files })
  }

  render() {
    return (
      <FileBase64
        multiple={ true }
        onDone={ this.getFiles.bind(this) } />
    )
  }

}


ReactDOM.render(<App />, document.getElementById("app"))

Props

multiple (Boolean)

Does your component support multiple files?

onDone (Function)

Callback function when all files have been processed

Thank You for Making this useful~

Let's talk about some projects with me

Just Contact Me At:

License

MIT Copyright (c) 2016 - forever Naufal Rabbani