Skip to content

jvilk/node-ar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ar

A Node library for reading Unix archive files.

Usage

var ar = require('ar'),
    fs = require('fs'),
    path = require('path');


// Extracts all of the files in "some_archive.a" to the folder "./output".
var outputDir = "./output";
if (!fs.existsSync(outputDir)) fs.mkdirSync(outputDir);

var archive = new ar.Archive(fs.readFileSync('some_archive.a'));
var files = archive.getFiles();
for (var i = 0; i < files.length; i++) {
  var file = files[i];
  fs.writeFileSync(path.resolve(outputDir, file.name()), file.fileData());
}

Status

  • Supports the BSD variant of the common archive format, which is used by BSD ar and Debian packages.
    • For some reason, GNU ar from GNU binutils (at least from Mac Homebrew) also uses the BSD format.
  • Does not support AIX (big), AIX (small), GNU ar, and other archive variants. If you want support for alternative formats, please make your case in a GitHub issue, or implement it yourself in a PR!

About

A Node library for reading Unix archive files.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published