ls-archive

Node module for archive files

View the Project on GitHub atom/node-ls-archive

Node Ls Archive Module Build Status

List or read the files and folders inside archive files.

Supported file extensions:

Installing

npm install ls-archive

Building

Using

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 objects.

archive.read(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 string contents.

archive.readGzip(gzipArchivePath, callback)

Read the contents of the gzipped archive path and invoke the callback with the string 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 string 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.