-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compress outgoing sync data in ZIP format #18
Comments
There is a possibility that users on an older version of Clippings (which can't handle sync data in ZIP format) may update to the new version of Sync Clippings Helper with data compression. To allow for backward compatibility, the compatible version of Clippings should send a new native message |
Compressing data into gzip format using Python:
|
The message data from the native app needs to be sent to the extension in JSON format, so the compressed data needs to be wrapped in a JSON object. Also, bytes cannot be stored in a JSON object, so the zipped data needs to be base64 encoded. This reduces the effectiveness of data compression. Some stats using the attached test sync file as an example: Size of the sync data, encoded in UTF-8 (bytes): 9538 If we consider 1 character to be equal to 1 byte in the base64-encoded string, then compressing the Sync Clippings data results in a reduction of 52% in the sync data size. |
A forum poster suggested compressing the synced clippings data into ZIP format to bypass the 1 MiB limit imposed by the native messaging API[1] to allow more data to be synced. Forum post: https://groups.io/g/aecreations-help/message/48
This only needs to be done for sync data being sent from Sync Clippings Helper to the extension. Incoming data to the native app has a more generous limit of 4 GiB.
--
[1] https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Native_messaging
The text was updated successfully, but these errors were encountered: