Provide the facility for browser-based applications to read and write files to and from the local file system in a simple manner. PureScript wrappers are supplied for the JavaScript functions readAsText, readAsBinaryString and URL.createObjectURL (with a text payload). The exported functions are:
- loadTextFile
- loadBinaryFileAsText
- saveTextFile
Note that readAsBinaryString is effectively deprecated in javascript. As far as I can tell, it was originally dropped from the W3C File API specification but later reappeared because of backward compatibility. The spec says that readAsArrayBuffer is preferred.
Because of this, I am a little leery of publishing the project, but nevertheless am doing so because I find it so useful when implementing load and save buttons.
If, alternatively, you intend to make use of Halogen's onFileUpload event, then this treats files in terms of the Web File API. This approach requires the use of a subsequent loadend callback which I think means that coroutines must be used if you need to get hold of the file's contents.
spago build
or
bower install
pulp build
npm run halogen-example
And then navigate to the halogen_example/dist directory.