npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

unzip-js

v1.0.0

Published

unzip .ZIP files in the browser

Downloads

1,130

Readme

unzip-js

Build Status Coverage Status npm JavaScript Style Guide

unzip .ZIP files in the browser

Install

npm install unzip-js

Usage

var unzip = require('unzip-js')

unzip(getBlobOrFileSomehow(), function (err, zipFile) {
  if (err) {
    return console.error(err)
  }

  zipFile.readEntries(function (err, entries) {
    if (err) {
      return console.error(err)
    }

    entries.forEach(function (entry) {
      zipFile.readEntryData(entry, false, function (err, readStream) {
        if (err) {
          return console.error(err)
        }

        readStream.on('data', function (chunk) { ... })
        readStream.on('error', function (err) { ... })
        readStream.on('end', function () { ... })
      })
    })
  })
})

API

unzip(source, callback)

  • source: must be a Blob, File or string that represents a valid url.
  • callback: function(err: Error, zipFile: ZipFile)

Class: ZipFile

zipFile.readEntries(callback)
Read metadata of all entries (parse Central Dircotroy Records).

  • callback: function(err: Error, entries: Entry[])

zipFile.readEntryData(entry, checkCrc, callback)
Read data of a specific entry.

  • entry: Entry
  • callback: function(err: Error, readStream: ReadStream)
  • checkCrc: boolean if true, performs a crc32 check on the extracted data.

Class: Entry
A representation of a zip entry (a Central Dircotroy Record).

see the zip spec section 4.3.12 Central directory structure for more informations.

entry.versionMadeBy: number
entry.versionNeededToExtract: number
entry.generalPurposeBitFlag: number
entry.compressionMethod: number
entry.lastModTime: number
entry.lastModDate: number
entry.crc32: number
entry.compressedSize: number
entry.uncompressedSize: number
entry.internalAttributes: number
entry.externalAttributes: number
entry.localHeaderOffset: number
entry.name: string
entry.commment: string
entry.extraFields: object[]

  • object: { headerId: number, dataSize: number, data: Buffer }

entry.encrypted: boolean
retrun true if the data is encrypted.

entry.lastModTimeDate: Date
Return a Date object representation of entry.lastModTime and entry.lastModDate.

Class: ReadStream
see blob-slicer.

Limitations

Only files stored with no compression or compressed with deflate algorithm are supported, zipFile.readEntryData callback will recieve an error for any entry with compression methode other than 0 (stored) or 8 (deflated), or if the file is encrypted.

Zip files spanned across multiple removable media are not supported.

Supported browsers

Firefox | Chrome | Internet Explorer | Edge | Safari | ios | Android ------- | ------ | ----------------- | ---- | ------ | --- | -------- YES | YES | YES (10 - 11) | YES | YES| YES | YES

License

MIT. Copyright (c) Merzouqi.