npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

rarfile

v0.2.3-1

Published

A library of functions to handle RAR archives

Readme

node-rarfile

Utility for handling rarfile archives using node.

Example

var rarfile = require('rarfile');
var rf = new rarfile.RarFile('./test/test.cbr');
console.log(rf.toString());
  // { names: [ '0.jpg', '2.jpg']}

//readFile function
rf.readFile('0.jpg', function(err, fdata) {
  console.log("File 0.jpg is " + fdata.length + " bytes long.");
});

//pipe function. New in v0.1.4
var fs = require('fs');
var outfile = fs.createWriteStream('2_copy.jpg');
rf.pipe('2.jpg', outfile);
});

Depends

  • node v0.8 and above

  • unrar free tool being in the path, as all its inner workings (with the exception of isRarFile function) relay on spawning unrar as a child process. As such, it's guaranteed to work on *nix systems which have unrar installed. Should work on Windows provided unrar is installed and it's executable is in the path. This has been recently tested,

  • when asyncronous library.

Installation

Install via npm:

npm install rarfile

API

node-rarfile module exports an object which exposes 3 properties

  • VERSION Current module version.

  • isRarFile function, which may be used to test if a file is RAR compressed

  • RarFile object, which must be instantiated with a RAR file path, otherwise will throw an error, and which features the following properties:

    • names (Object): an array containing the names of the archived files

    • readStream (Function): called with the file which data will be retrieved, returns the output stream of unrar child process, which may be piped to another stream or whatever use you see fit. There are some issues remaining for binary data (i.e. images)

    • readFile (Function): must be called with two parameters:

        1. Name of a file within the archive
        1. A callback function meant to handle the file data.
    • pipe (Function): meant to make RarFile instances to behave like a ReadStream, it takes an additional (first) parameter, the name of the archived file to be piped, thus relegating the name of the write stream to the second formal parameter. (See the previous example)

Motivation

For one thing, I couldn't find a node.js unrar utility along the lines of node-zipfile, and thought one should be available.

It's worth noting though, that in spite of trying to make an API as close as was possible to the aforementioned, the inner workings of both are very different.

node-zipfile is a much more complete piece of software, as you can easily figure out by examining the source codes of both. node-rarfile is just a thin wrapper around unrar, anyway I hope it may be useful.

License

MIT, see LICENSE