New package alternative/complementary to elm/file

Package: GitHub - mpizenberg/elm-file: Alternative to elm/file that can be encoded and passed through ports
Ellie: https://ellie-app.com/cGtMSj4QnPWa1

I am in need of processing files with WebAssembly on a recent project but the File type provided by elm/file cannot be encoded and sent to JS via a port. So I’ve been using an alternative File type defined as

type File =
    { value : Json.Decode.Value
    , name : String
    , mime : String
    , size : Int
    , lastModified : Time.Posix
    }

It is quite convenient to pass through a port and can still be transformed into the official File type via its decoder if needed. I’ve also added helper functions to upload files via file input or drag and drop. Here is an example Ellie.

elm-file

18 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.