I am working on a simple S3 image uploader in Elm. I’d like to name the uploaded file by a prefix of its SHA1 sum, as a primitive deduplication effort and also to supply a reasonable unique name for the file.
I use an ordinary
input[type="file"] to get the file, which means I receive a
File type back. How do I compute a SHA1 of that? I tried TSFoster/elm-sha1, but that needs the data as
List Int, whereas
File.toBytes gets me
Conversion shouldn’t be expensive. I haven’t tried this, but looking into the codebase of the packages you’re using, the SHA1.fromBytes method that needs
List Int is initially filtering such a list between 0–255.
That means that you can parse your
Sounds like a neat project. I’ve replied on the Github issue you created, hopefully you’ll be able to work it out, or wait for a few weeks for me to take a look :-).
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.