javascript - Transform Blob from XmlHttpRequest without loading it completely into memory -
i want implement client-side file decryption in browser. takes decrypted files server , should decrypt in browser, presenting save as dialog save decrypted file. should work large files (1 gb or more).
i have following strategy in mind:
- download file using
xmlhttprequest
responsetype = 'blob'
. - decrypt transforming blob given
xmlhttprequest
. - provide decrypted blob
objecturl
user.
the decryption work stream transformation, reads chunks downloaded blob, decrypts data , writes output blob.
however far can tell work current browsers if can load whole file memory (you need store complete decrypted blob in memory before can create objecturl
). seems no kind of chunked reading/writing supported current blob
, xmlhttprequest
, createobjecturl
interface described on mozilla developer network. blob immutable , there doesn't seem streaming support binary data in browsers.
is there way implement current browsers?
after getting blob
responsetype = 'blob';
, can use blob.slice(start, end)
subview , use filereader
api grab data associated subview.
Comments
Post a Comment