node-osdb-hash
v1.0.1
Published
Implementation of OSDb hash in nodejs
Downloads
6
Readme
Opensubtitles API (OSDb protocol) Hash Implementation
Implementation of the OSDb hash in nodejs, for use with Opensubtitles Database (OSDb)
Installation
$ npm install node-osdb-hash
Usage
Synchronous
var osh = require('node-osdb-hash');
var hash = osh.hashSync('/path/to/movie/file');
console.log(hash); // Eg : '8e245d9679d31e12'
Asynchronous
var osh = require('node-osdb-hash');
osh.hash('/path/to/movie/file', function (err, hash) {
if(err) return console.error(err);
console.log(hash); // Eg : '8e245d9679d31e12'
}
Using Events
var osh = require('node-osdb-hash');
var hasher = osh.hash('/path/to/movie/file');
hasher.on('hashReady', function (hash){
console.log(hash); // Eg : '8e245d9679d31e12'
}
hasher.on('error', function (err) {
console.error(err);
}
hasher.calculateHash();