Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/atom/node-ls-archive
Node Module for archive files
https://github.com/atom/node-ls-archive
Last synced: 4 months ago
JSON representation
Node Module for archive files
- Host: GitHub
- URL: https://github.com/atom/node-ls-archive
- Owner: atom
- License: mit
- Archived: true
- Created: 2013-04-12T23:20:58.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2022-10-12T09:30:13.000Z (about 2 years ago)
- Last Synced: 2024-08-07T19:17:58.809Z (4 months ago)
- Language: CoffeeScript
- Homepage: http://atom.github.io/node-ls-archive
- Size: 155 KB
- Stars: 18
- Watchers: 10
- Forks: 20
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
##### Atom and all repositories under Atom will be archived on December 15, 2022. Learn more in our [official announcement](https://github.blog/2022-06-08-sunsetting-atom/)
# 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
* .tar.bz2
* .tbz
* .tbz2
* .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.### archive.readBzip(bzipArchivePath, callback)
Read the contents of the bzipped archive path and invoke the callback with the
Buffer contents of the uncompressed paths. The `callback` gets two arguments
`(error, pathContents)`.`bzipArchivePath` - The string path to the bzipped 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.