Skip to content
This repository has been archived by the owner on Mar 3, 2021. It is now read-only.

CommitChange/ff-file-uploader

 
 

Repository files navigation

ff-file-uploader

Features:

  • whitelist file types
  • set a max file size
  • drag and drop
  • hides drag and drop UI on mobile
  • overrides default <input type='file'> styles
  • returns the following streams:
    • file$
    • error$ (based on whitelisted file types and max file size)
    • image$ (if file type is image)
    • text$ (if file type is text)

Demo: https://flimflamjs.github.io/ff-file-uploader/

Usage:

const uploader = require('ff-image-uploader')

const init = () => {
  let state = {}
  state.uploader = uploader.init({fileTypes: ['jpeg', 'png', 'plain'], maxKB: 2000})
  return state
}

const view = state =>
  h('div'
  , [
      uploader.view({
        noDrag: true // optional - hides drag and drop UI
      , dragContent: h('h3', 'Drag to upload a file...') // optional
      , clickContent: h('button', 'or browse...') // optional
      , state: state.uploader
      })
    ]  
  )

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 86.3%
  • CSS 6.5%
  • HTML 4.2%
  • Shell 3.0%