# ls-archive

> A package for listing and reading files in archive files

Latest version **1.3.4** (published 2020-02-10) · 0 weekly downloads

## Install

```sh
npm install ls-archive
pnpm add ls-archive
yarn add ls-archive
bun add ls-archive
```

Provides the command `lsa`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.4 |
| Published | 2020-02-10 |
| First published | 2013-04-16 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 17.3 KB |
| Known vulnerabilities | 0 (+15 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 18 |
| Author | Kevin Sawicki |
| Maintainers | as-cii, atom-team, izuzak, jasonrudolph, kevinsawicki, lee-dohm, zcbenz |
| Keywords | ls, zip, gzip, tar, unzip, gunzip, archive, archives, uncompress |

## Links

- npm: https://www.npmjs.com/package/ls-archive
- Repository: https://github.com/atom/node-ls-archive
- Homepage: http://atom.github.io/node-ls-archive
- Issues: https://github.com/atom/node-ls-archive/issues
- npm.io page: https://npm.io/package/ls-archive

## Dependencies (6)

- [tar](https://npm.io/package/tar.md) ^2.2.1
- [async](https://npm.io/package/async.md) ~0.2.9
- [yauzl](https://npm.io/package/yauzl.md) ^2.9.1
- [colors](https://npm.io/package/colors.md) ~0.6.2
- [rimraf](https://npm.io/package/rimraf.md) ~2.2.6
- [optimist](https://npm.io/package/optimist.md) ~0.5.2

## Alternatives

- [lodash.startswith](https://npm.io/package/lodash.startswith.md) — 769.7K weekly downloads
- [@tarojs/service](https://npm.io/package/@tarojs/service.md) — 33.9K weekly downloads
- [io.extendreality.tilia.indicators.spatialtargets.unity](https://npm.io/package/io.extendreality.tilia.indicators.spatialtargets.unity.md) — 131 weekly downloads
- [@rtarojs/taro](https://npm.io/package/@rtarojs/taro.md) — 90 weekly downloads
- [node-branch-io](https://npm.io/package/node-branch-io.md) — 50 weekly downloads

## Recent versions

- 1.3.4 (latest) — 2020-02-10
- 1.3.1 — 2018-07-03
- 1.3.0 — 2018-06-05
- 1.2.5 — 2018-05-07
- 1.2.3 — 2017-03-30
- 1.2.2 — 2016-09-06
- 1.2.1 — 2015-08-19
- 1.2.0 — 2015-07-29
- 1.1.1 — 2015-06-08
- 1.1.0 — 2015-04-02
- 1.0.3 — 2015-02-10
- 1.0.2 — 2014-09-12
- 1.0.1 — 2014-07-13
- 1.0.0 — 2014-05-15
- 0.13.0 — 2014-02-28
- … 12 more at https://npm.io/package/ls-archive/versions

## README

# Node Ls Archive Module [![Build Status](https://travis-ci.org/atom/node-ls-archive.png)](https://travis-ci.org/atom/node-ls-archive)

List or read the files and folders inside archive files.

Supported file extensions:

  * .epub
  * .jar
  * .love
  * .nupkg
  * .tar
  * .tar.gz
  * .tgz
  * .war
  * .zip
  * .egg
  * .whl
  * .xpi

## Installing

```sh
npm install ls-archive
```

## Building
  * Clone the repository
  * Run `npm install`
  * Run `grunt` to compile CoffeeScript code
  * Run `grunt test` to run the specs

## Using

```coffeescript
archive = require 'ls-archive'
```

### archive.list(archivePath, callback)

List the files and folders inside the archive file path. The `callback` gets
two arguments `(error, archiveEntries)`.

`archivePath` - The string path to the archive file.

`callback` - The function to call after reading completes with an error or
an array of [ArchiveEntry](#archiveentry) objects.

### archive.readFile(archivePath, filePath, callback)

Read the contents of the file path in the archive path and invoke the callback
with those contents. The `callback` gets two arguments
`(error, filePathContents)`.

`archivePath` - The string path to the archive file.

`filePath` - The string path inside the archive to read.

`callback` - The function to call after reading completes with an error or
the Buffer contents.

### archive.readGzip(gzipArchivePath, callback)

Read the contents of the gzipped archive path and invoke the callback with the
Buffer contents of the uncompressed paths.  The `callback` gets two arguments
`(error, pathContents)`.

`gzipArchivePath` - The string path to the gzipped archive file.

`callback` - The function to call after reading completes with an error or
the Buffer contents.

### ArchiveEntry

Class representing a path entry inside an archive file.

#### .isFile()
Is the entry a file?

Returns `true` if a file, `false` otherwise.

#### .isFolder()
Is the entry a folder?

Returns `true` if a folder, `false` otherwise.

#### .isSymbolicLink()
Is the entry a symbolic link?

Returns `true` if a symbolic link, `false` otherwise.

#### .getPath()
Get the path of this entry.

Returns the string path.

---
_Source: https://npm.io/package/ls-archive · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
