I am working on a Chrome extension that communicates with an external executable through Chrome messaging protocol. The external application either accepts absolute path of a media file or gets its binary content from stdout
.
Since only the extension side has access to the actual file (from drag and drop operation) and there is no way to send the absolute path to the external application, I figured I would read the binary input file through FileReader
and send the binary to the executable. Though there doesn't seem to be a good way to send and receive binary string (or typed array) to/from an external executable.
I wish there was a way to just send the pointer of where the typed array is located.
Any idea how a large binary string can be sent and received from an external executable through the native messaging protocol.
https://developer.chrome.com/extensions/nativeMessaging
There is no other way than using an own protocol to split the binary data and transport them base64 encoded via JSON from the browser extension to the native application which then collects the binary chunks together. Note that the JSON string can have a maximum of 4 GB (Chrome, Firefox) or 2 GB (MS Edge, as it uses 16 bit characters internally) in total size which needs to be considered when creating the message chunks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With