Thank you Simon for the example, this is great! I created a new thread 
<`https://groups.google.com/forum/#!topic/elm-discuss/fVFXqEHpxAQ> to 
collect design ideas. Could you create a gist and post the link there?

On Wednesday, August 10, 2016 at 6:24:49 PM UTC+2, Simon wrote:
>
> I think this is the sort of code I would like to be able to write to do 
> signed S3 uploads
>
>
> FileReader API
>
> readFile : FileRef -> Task Error Blob
>
> and in the Http library
>
> blobData : Blob -> Http.Data
>
> such that
>
> get ("signature" := string) "/get_signature"
> `Task.andThen`
>     \sig -> 
>         readFile ref
>         `Task.andThen`
>             \content ->
>                 let 
>                     body = 
>                         multipart 
>                             [ ("signature", stringData signature)
>                             , ("file", blobData content)
>                             ]
>                 in
>                 Http.send defaultSettings
>                     { verb = "POST"
>                     , headers = [("Origin", origin)]
>                     , url = "http://bucket-name.s3.amazonaws.com/";
>                     , body = body
>                     }
>                 |> Http.fromJson ("ETag" := string)
>
> On Saturday, 30 July 2016 21:06:55 UTC+2, Jan Weitz wrote:
>
> I would like Binary decoders/encoders as John Watson  mentioned, as well.
>>
>>
>> - Encoding/Decoding MQTT messages (which itself might contain Protobuf 
>> messages) [
>> http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718013
>> ]
>> - Encoding/Decoding Protobuf3 binary messages [
>> https://developers.google.com/protocol-buffers/docs/encoding]
>>
>> Inspirations for native interfaces (for web or server-side) might be:
>>
>> - https://github.com/dcodeIO/bytebuffer.js [Native/bytebuffer.js and 
>> ByteBuffer.elm]
>> - https://github.com/dcodeIO/long.js
>> - (https://github.com/dcodeIO/ProtoBuf.js) [Should be regular elm code]
>> - (https://github.com/google/protobuf/tree/master/js/binary) [Should be 
>> regular elm code]
>>
>>
>>
>> On Thursday, July 28, 2016 at 11:17:51 PM UTC+2, Daniel Bachler wrote:
>>>
>>> I'd love to see support for the File and ArrayBuffer Apis, and maybe 
>>> TypedArrays/DataViews as well. IMHO they are an important piece of the Web 
>>> Platform that is still missing in Elm.
>>>
>>> Evan suggested collecting concrete use cases to guide the design. I 
>>> would like this thread to be the starting point of this effort. I would 
>>> like to ask anyone who would also like this feature or who has substantial 
>>> experience using either Api to add use cases or comment here so that we can 
>>> try to define the user story for both apis. From there, we could decide 
>>> what we would like to see supported and what, if anything, we don't need 
>>> for now and suggest Elm Apis.
>>>
>>> I have two stories from a side project of mine. It is a slideshow editor 
>>> that allows the user to select photos and audio files from the local 
>>> system, uploads them to a web service, let's the user arrange and 
>>> manipulate photos and music and then share the result with others. For 
>>> this, I have two immediate use cases plus some more ideas:
>>>
>>> *Upload local files as binary blob to AWS S3*
>>>
>>> In my current, (hacky) version, I use the FileReader api (via 
>>> simonH1000's filereader library) to read the content of a file into an 
>>> ArrayBuffer, (represented as Json.Value in Elm) then use a modified version 
>>> of elm-http to upload the content of the ArrayBuffer to an S3 storage 
>>> bucket.
>>>
>>> *Download mp3 files, decode them and play them back via the AudioApi*
>>>
>>> Currently I do this with my modified http library to download the mp3 
>>> file into an arraybuffer, then pass the resulting arraybuffer through a 
>>> port to some native javascript that then uses the Audio Api to decode the 
>>> mp3 file into a playable audiobuffer.
>>>
>>> *Parsing or otherwise processing local text files. *
>>>
>>> For another project I would be interested in reading and parsing 
>>> Swagger/OpenAPI definition files and then providing a UI to compare rest 
>>> apis. Since the processing will be done on simple Strings, this would only 
>>> require FileReader support (specifically the readAsText method). This would 
>>> already work with the FileReader library as is (though that one is not 
>>> available on package.elm-lang.org because it contains native code and 
>>> is not whitelisted).
>>>
>>> *TypedArrays and DataViews*
>>>
>>> I haven't worked with these yet, but I can anticipate some cases that 
>>> would be interesting:
>>>
>>> *Parsing/manipulating of binary data via the ArrayBuffer api.*
>>>
>>> One case I personally would like to do with this, is to parse the Exif 
>>> header of the jpeg files the user loaded from the local file system. My 
>>> slideshow could then display metadata information without roundtripping to 
>>> the server.
>>>
>>> *Create geometry for WebGL in the form of Vertex Buffers*
>>>
>>> *Generating sound/music by writing raw audio samples*
>>>
>>> These could then be played back via the Web audio apis.
>>>
>>>
>>> Please add your own ideas to this thread. Once we have compiled a list 
>>> of use cases, we can look at the JS Apis available under the Web Platform 
>>> for Files, ArrayBuffers, Typed Arrays etc. and think how these could be 
>>> exposed to Elm. 
>>>
>> ​
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to