Created
December 20, 2019 16:47
-
-
Save canimus/ee709979af82c2cf1623fc51af7e5aef to your computer and use it in GitHub Desktop.
msgpack javascript example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function readFile(stream) { | |
return new Promise((resolve, reject) => { | |
var fr = new FileReader(); | |
fr.onload = () => { | |
resolve(msgpack.decode(new Uint8Array(fr.result))) | |
}; | |
fr.readAsArrayBuffer(stream); | |
}); | |
} | |
fetch("/static/m1.msgpack") | |
.then(r => r.blob()) | |
.then(readFile) | |
.then(console.log) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment