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 get new ArrayBuffer(2).
How can I convert the ArrayBuffer back to an object?
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
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?