{"action":"closed","issue":{"url":"https://api.github.com/repos/satazor/js-spark-md5/issues/40","repository_url":"https://api.github.com/repos/satazor/js-spark-md5","labels_url":"https://api.github.com/repos/satazor/js-spark-md5/issues/40/labels{/name}","comments_url":"https://api.github.com/repos/satazor/js-spark-md5/issues/40/comments","events_url":"https://api.github.com/repos/satazor/js-spark-md5/issues/40/events","html_url":"https://github.com/satazor/js-spark-md5/issues/40","id":177613044,"number":40,"title":"Streams","user":{"login":"jimmywarting","id":1148376,"avatar_url":"https://avatars.githubusercontent.com/u/1148376?v=3","gravatar_id":"","url":"https://api.github.com/users/jimmywarting","html_url":"https://github.com/jimmywarting","followers_url":"https://api.github.com/users/jimmywarting/followers","following_url":"https://api.github.com/users/jimmywarting/following{/other_user}","gists_url":"https://api.github.com/users/jimmywarting/gists{/gist_id}","starred_url":"https://api.github.com/users/jimmywarting/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimmywarting/subscriptions","organizations_url":"https://api.github.com/users/jimmywarting/orgs","repos_url":"https://api.github.com/users/jimmywarting/repos","events_url":"https://api.github.com/users/jimmywarting/events{/privacy}","received_events_url":"https://api.github.com/users/jimmywarting/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-09-17T22:10:53Z","updated_at":"2016-11-30T22:32:49Z","closed_at":"2016-11-30T22:32:49Z","body":"Do you know what would be cool? Hashing a large file with streams!\n\nThe [spec](streams.spec.whatwg.org) is coming together and just thought \"hey it would be cool to use it in md5 spark!\"\n\nThere is two ways you can do it. Either as a WritableStream or ReadableStream\nif you would give a ReadableStream to the api then it would be in control and could handle the buffer allocation with BYOB.\n\nHowever the `append()` operator is more like a WriteStream so you would need to provide a way to create write stream that is connected in the core\n\nCurrently you can get a ReadableStream from a the fetch api in Blink. You can also construct a ReadableStream in Blink now or you could use the [web-streams-polyfill](https://npmjs.com/package/web-streams-polyfill)\n\nSo it would make since to just hand it over to spark in some way\nI have also created a way to get a ReadableStream from blob/files with [Screw-FileReader](https://npmjs.com/package/screw-filereader)\n\nOne way you could do it is\n\n``` javascript\nws = spark.createWriteStream()\nblob.stream().pipeTo(ws).then(() => spark.end())\n```\n\nor just hand over the ReadableStream to spark in some way, cuz of right now fetch ReadableStream don't have pipeTo yet since WriteableStream is not implemented\n\none possible way would also be to hash it and upload it at the same time\ngiven by the example with [tee()](https://streams.spec.whatwg.org/#rs-tee)\n"}}
{"actor":{"display_login":"satazor"}}