Git Product home page Git Product logo

node-ls-archive's Introduction

Atom and all repositories under Atom will be archived on December 15, 2022. Learn more in our official announcement

Node Ls Archive Module Build Status

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

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

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

node-ls-archive's People

Contributors

50wliu avatar chrismissal avatar darangi avatar izuzak avatar jasonrudolph avatar kevinsawicki avatar lebannehn avatar mjansing avatar mnquintana avatar pjeby avatar thomasjo avatar ytvwld avatar zcbenz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-ls-archive's Issues

Doesn't work with node v0.11.x

The node-unzip doesn't work with node v0.11.x and would get into infinite loop when unzipping some files, it should be related to how it waited for results (by busy waiting, which is rather bad).

Since node-ls-archive is using node-unzip, I think we should replace it with a more reliable unzip module so node-ls-archive can work with node v0.11.x.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.