Created
August 31, 2018 14:08
-
-
Save fanyer/8455b947fd52847e1362794324746f09 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
let fs = require("fs"); | |
let pako = require("pako"); | |
let str = fs.readFileSync( | |
__dirname + "/903977b432af87d0cfb7766bbe038a8f76ca78" | |
); | |
function Uint8ToString(u8a) { | |
let CHUNK_SZ = 0x800000; | |
let c = []; | |
for (let i = 0; i < u8a.length; i += CHUNK_SZ) { | |
c.push(String.fromCharCode.apply(null, u8a.subarray(i, i + CHUNK_SZ))); | |
} | |
return c.join(""); | |
} | |
// let input = pako.deflate(str); | |
console.log(str.length); | |
let output = pako.inflate(str); | |
// console.log(output); | |
console.log(String.fromCharCode.apply(null, output)); | |
// console.log(Uint8ToString(output)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment