How to decode heatshrink #4649
Unanswered
espruino-discuss2
asked this question in
Bangle.js
Replies: 1 comment
-
Posted at 2022-05-09 by @gfwilliams I'm afraid you can't, since heatshrink compresses only a sequence of bytes, not a structure. If you want to compress it and get the data back, you'll need to compress the JSON, so:
However this may be counterproductive. It's only when you decode it with |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2022-05-07 by Asynchronous
I compress an object:
schedule = require("heatshrink").compress(JSON.parse(require("Storage").read("CustomSchedule.json")));
Printing the value of schedule returns
new Uint8Array([0, 2]).buffer
.I then decompress using
console.log(require("heatshrink").decompress(schedule));
and getnew ArrayBuffer(2)
.How can I convert the ArrayBuffer back to an object?
Beta Was this translation helpful? Give feedback.
All reactions