JSPM

  • Created
  • Published
  • Downloads 965
  • Score
    100M100P100Q106958F
  • License MIT

A cross-platform npm distribution for HandbrakeCLI designed for command line and/or library use.

Package Exports

  • handbrake-js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (handbrake-js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Build Status githalytics.com alpha

handbrake-js

A cross-platform npm distribution for HandbrakeCLI (v0.9.9) designed for command line or library use.

As a command line tool

Install

$ npm install -g handbrake-js

Mac / Linux users may need to run the above with sudo

Usage

Call handbrake-js as you would HandbrakeCLI, using all the usual options:

$ handbrake-js --input "Ballroom Bangra.avi" --output "Ballroom Bangra.mp4" --preset Normal

As a library

Install

$ npm install handbrake-js

HandbrakeCLI installation

On Windows and Mac OSX installing handbrake-js automatically installs the correct HandbrakeCLI binary for your platform. Ubuntu users should additionally run:

$ sudo npm -g run-script handbrake-js ubuntu-setup

API Documentation

##Methods

###exec

Runs HandbrakeCLI with the supplied options calling the supplied callback on completion. The exec method is best suited for short duration tasks where you can wait until completion for the output.

####Parameters

  • options Object | Thing | Array

    Options to pass directly to HandbrakeCLI

  • onComplete Function

    If passed, onComplete(err, stdout, stderr) will be called on completion, stdout and stderr being strings containing the HandbrakeCLI output.

####Example

handbrake.exec({ preset-list: true }, function(err, stdout, stderr){
    if (err) throw err;
    console.log(stdout);
});

###spawn

Spawns a HandbrakeCLI process with the supplied options, returning a handle on the running process.

####Parameters

  • options Object | Thing | Array

    Options to pass directly to HandbrakeCLI

Returns: HandbrakeProcess
A handle on which you can listen for events on the Handbrake process.

####Example

var handbrake = require("handbrake-js");

var options = {
    input: "Eight Miles High.mov",
    output: "Eight Miles High.m4v",
    preset: "Normal"
};

handbrake.spawn(options)
    .on("error", function(err){
        console.log("ERROR: " + err.message);
    })
    .on("output", console.log);
    .on("progress", function(progress){
        console.log(progress.task + ": " + progress.percentComplete);
    })
    .on("complete", function(){ 
        console.log("Done!"); 
    });