Streaming a file to a web app

Hello all,
I am new to PureScript but would describe myself as proficient in Haskell and Elm. I am hoping that PureScript will let me do a lot of things that I couldn’t do in pure Elm.

To the problem at hand: I am trying to figure out how to stream a file to a web app and operate on it, chunk by chunk. For now, I would just like to log that each chunk has been received, but I will progress to parsing and operating on the bytes in the chunks. I am not really sure how to get started and build the stream.

I am trying to do this with Halogen and I have made a file input that acts on an event and logs the name of the selected file. I think I need to use the purescript-web-streams package to make the file into a source, but I don’t know how to do that. On the JavaScript side, I think you can get a stream straight from a file.

Any advice on how to start is greatly appreciated!

this looks interesting: GitHub - rowtype-yoga/purescript-fetch

As for purescript-web-streams - Pursuit,
some of these listings may be good examples: https://github.com/search?q="web-streams"+path%3A*.dhall&type=code&p=1

1 Like

Thank you! I don’t think these are quite what I am looking for. I am taking this as a good opportunity to learn about PureScripts FFI - I think that is the easiest way to go about doing this.