JSPM

readzip

2.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 172
  • Score
    100M100P100Q83341F
  • License MIT

read zip archive in simplest possible way

Package Exports

  • readzip
  • readzip/lib/readzip.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (readzip) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Readzip License NPM version Build Status Coverage Status

Read zip archive in simplest possible way.

Install

npm i readzip

API

path contains information about current file, it has next methods:

  • isFile([name]) check if current entitiy is file, also compares path, when name passed;
  • isDirectory([name]) checks if current entity is directory, also compares path, when name passed;
  • openReadStream - promise, returns file stream;
  • stop - close archive file and break from traversing loop;

Also path has fields that can be used to get some information

  • name
  • size
  • date
  • mode
  • directory
  • type
  • owner
import readzip from 'readzip';

const archivePath = './hello.zip';

for await (const path of readzip(archivePath)) {
    const {name} = path;
    
    if (path.isFile()) {
        console.log('file:', name);
    }
    
    if (path.isDirectory()) {
        console.log('directory:', name);
    }
}

Similar to info returned by readify.

  • redzip - work with zip archives as it is regular files and directories
  • readify - read directory content with file attributes: size, date, owner, mode
  • readbox - read file or directory from dropbox

License

MIT