Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mpizenberg/elm-file
Alternative to elm/file that can be encoded and passed through ports
https://github.com/mpizenberg/elm-file
Last synced: about 2 months ago
JSON representation
Alternative to elm/file that can be encoded and passed through ports
- Host: GitHub
- URL: https://github.com/mpizenberg/elm-file
- Owner: mpizenberg
- License: bsd-3-clause
- Created: 2021-03-20T14:18:25.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-03-20T16:02:05.000Z (almost 4 years ago)
- Last Synced: 2024-05-09T13:40:04.541Z (8 months ago)
- Language: Elm
- Size: 9.77 KB
- Stars: 7
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# elm-file
[![][badge-license]][license]
[![][badge-doc]][doc][badge-doc]: https://img.shields.io/badge/documentation-latest-yellow.svg?style=flat-square
[doc]: http://package.elm-lang.org/packages/mpizenberg/elm-file/latest
[badge-license]: https://img.shields.io/badge/license-BSD--3--Clause-blue.svg?style=flat-square
[license]: https://opensource.org/licenses/BSD-3-ClauseAlternative to [`elm/file`][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][screenshot]
[elm/file]: [email protected]:mpizenberg/elm-file.git
[screenshot]: https://mpizenberg.github.io/resources/elm-file/elm-file.png