Skip to content

Alternative to elm/file that can be encoded and passed through ports

License

Notifications You must be signed in to change notification settings

mpizenberg/elm-file

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

elm-file

Alternative to elm/file that can be encoded and passed through ports.

The File type provided by elm/file cannot be encoded and passed through ports. It is thus impossible to process files via WebAssembly or JS for tasks that aren't possible or efficient enough in Elm.

This package provides an alternative File type, which is basically a record with a JavaScript Value containing the actual file, and some fields for basics file properties. The Value can thus be passed intact through a port to JavaScript if needed.

This package will become obsolete the day Elm has a 0-cost way of passing a File through a port to JS.

For convenience, this package also provides helper functions to load files via a file input or a drop area.

An example usage is provided in the example/ directory.

elm-file example screenshot

About

Alternative to elm/file that can be encoded and passed through ports

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages