Skip to content

Support for Node.js FileSystem (fs) and ReadableStreams

Jakub Žitný edited this page Mar 4, 2017 · 2 revisions

Caveats

There has been a lot of discussion in the Node community about supporting automatic marshalling of its ReadableStream to a Blob or ArrayBufferView but those discussions didn't go anywhere and the tickets were closed. As a result, this version of Evaporate does the marshalling work until Node decides to do that work. This means that its memory usage behavior may be different when using streams than when using Blobs.

Evaporate's implementation exposes a new configuration option readableStreamPartMethod which is currently enabled with readableStreams so as to avoid any additional dependencies. Node's fs module provides this support, so just include it on the closure that wraps readableStreamPartMethod.

There is an example in examples/electron' that borrows from [electron-quick-start](https://github.com/electron/electron-quick-start). If someone wants to contribute the code to actually open a native File picker, it would be appreciated. The example uses Chromium's built-in support behind the File Input and assumes that the file is in the Desktop` folder.

Installation

The electron sample is in examples/electron. You will need to update examples/electron/index.html with your AWS keys and other signature/signing options. You will probably want to adjust readableStreamPartMethod to your needs as well.

Or better yet, implement a native file picker and submit the improvements to Evaporate.

cd examples/electron

Install the development dependencies: electron and evaporate:

npm install

To start the example:

npm start