Created
April 24, 2021 12:36
-
-
Save barnjamin/59a483ef90b8e5c49be88f0cbafe1b72 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 download_txns(name, txns) { | |
let b = new Uint8Array(0); | |
for(const txn in txns){ | |
b = concatTypedArrays(b, txns[txn]) | |
} | |
var blob = new Blob([b], {type: "application/octet-stream"}); | |
var link = document.createElement('a'); | |
link.href = window.URL.createObjectURL(blob); | |
link.download = name; | |
link.click(); | |
} | |
function concatTypedArrays(a, b) { | |
var c = new (a.constructor)(a.length + b.length); | |
c.set(a, 0); | |
c.set(b, a.length); | |
return c; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment