Git Product home page Git Product logo

unrar.js's Introduction

unrar.js

This is a pure-javascript implementation of unrar. The code has been ported from Jeff Schiller's bitjs, Thanks :).

how to use:

synchronous usage:

var unrar = require('unrar.js'),
    fs = require('fs'),
    unpackedFiles;

unpackedFiles = unrar.unrarSync("ARCHIVE_PATH", {
    onProgress: function(data) {
        var l_nPercent = Math.round((data.currentBytesUnarchived / data.totalUncompressedBytesInArchive) * 100);
        console.log("Progress: ", l_nPercent, "%");
    }
});

unpackedFiles.forEach(function(file){
    console.log(file.filename, file.fileData.length);
});

asynchronous usage:

var unrar = require('unrar.js'),
    fs = require('fs');

unrar.unrar("ARCHIVE_PATH", "OUTPUT_DIRECTORY", {
    onProgress: function(data) {
    	var l_nPercent = Math.round((data.currentBytesUnarchived / data.totalUncompressedBytesInArchive) * 100);
    	console.log("Progress: ", l_nPercent, "%");
	}
}, function(err, unpackedFiles) {
    unpackedFiles.forEach(function(file){
	    console.log(file.filename, file.fileData.length);
	});
});

the asynchronous method needs to write to disk because it runs in a child process, and transferring the binaries over a string channel is pretty damn slow. Maybe one day, I'll try using local sockets ;)

Changelog

  • 0.2.5 — fixed bad require case for case sensitive filesystems in subprocess
  • 0.2.1 — fixed bad path for forked Unrar sub process (in previous check-in)
  • 0.2.0 — added sync and async (forked process) execution of unrar
  • 0.1.0 — Initial Release

unrar.js's People

Contributors

boggan avatar

Watchers

Eduardo Quagliato avatar James Cloos avatar

Forkers

muskanmahajan37

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.