Created
January 14, 2020 22:05
-
-
Save dneprDroid/5759338971fd095a50e839f7035b903b to your computer and use it in GitHub Desktop.
Save text file JS
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
| var sampleBytes = new Int8Array(4096*1000*100); | |
| var saveByteArray = (function () { | |
| var a = document.createElement("a"); | |
| document.body.appendChild(a); | |
| a.style = "display: none"; | |
| return function (data, name) { | |
| var blob = new Blob(data, {type: "octet/stream"}), | |
| url = window.URL.createObjectURL(blob); | |
| console.log("Blob URL: ", url); | |
| a.href = url; | |
| a.download = name; | |
| a.click(); | |
| window.URL.revokeObjectURL(url); | |
| }; | |
| }()); | |
| saveByteArray([sampleBytes], 'example2.txt'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment