unzip-buffer
v1.0.1
Published
Unzips a buffer into a clean json.
Downloads
5
Readme
Example:
const c = require("unzip-buffer").unzipToArr;
const fs = require("fs")
const path = require("path")
let b = fs.readFileSync("./arc.jar")
let zip = c(
b //buffer,
get = { write: true } //what properties to get,
options = { writeTo: "./jar"}, //options { writeTo = where to write }
pathReplacer = function(d) { //function to replace paths when being extracted
let splt = d.split(path.sep)
splt[splt.length - 1] = "file.txt"
return splt.join(path.sep)
}
)
zip.forEach(f => f.write()) //extracts to ./jar, changes all files to file.txt
Not an arr:
const c = require("unzip-buffer").unzip;
let b = fs.readFileSync("./arc.jar")
let zip = c(b);
console.log(zip["META-INF/manifest.mf"].data) //buffer of data