unzip-buffer

1.0.1 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i unzip-buffer

Weekly Downloads

0

Version

1.0.1

License

ISC

Unpacked Size

4.96 kB

Total Files

4

Last publish

Collaborators

  • loganisadev2npm