-
Notifications
You must be signed in to change notification settings - Fork 11
Support for binary file transfer in ipywidgets 7 #20
Comments
+1 for a standard widget, that would be nice! Binary upload should be easy to support, as there is FileReader#readAsBinaryString. |
@jasongrout I just realised that FileReader#readAsBinaryString is non-standard: |
You'll want to use https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsArrayBuffer - ArrayBuffers are what ipywidgets recognizes as a binary state value. |
@jasongrout looks like a winner to me. It even works on Edge. The only thing is the status is listed as working draft should we expect drastic changes in the future or will it stay more or less as is? |
Good question. We can update the code if it does change. |
But it seems to have been implemented for years - it sounds pretty safe. |
@peteut I modified the code to support binary file. And I plan to contribute the patch back. Would you mind to review the patch?If yes, I will need to go through my company's open source process first. Thanks. |
In ipywidgets 7.0, attributes can be binary and will then be synced with binary messages. That may make a big difference for large files (instead of base64 encoding them).
Also, FYI, @draperjames was looking into making a standard file upload widget in the base ipywidgets package (jupyter-widgets/ipywidgets#1542). Would you be willing to collaborate on such a standard widget?
Thanks for writing this!
The text was updated successfully, but these errors were encountered: