Skip to content

Commit

Permalink
Replace Q by when
Browse files Browse the repository at this point in the history
Q's new version as a different support of progress. when keeps
progress like it is suposed to be.
  • Loading branch information
q2s2t committed Aug 25, 2014
1 parent f7d2b47 commit 1a10869
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 15 deletions.
8 changes: 4 additions & 4 deletions lib/extractFull.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';
var path = require('path');
var Q = require('q');
var when = require('when');
var u = {
run: require('../util/run'),
switches : require('../util/switches')
Expand All @@ -12,8 +12,8 @@ var u = {
* @progress {array} Extracted files and directories.
* @reject {Error} The error as issued by 7-Zip.
*/
module.exports = function (archive, dest, options, cb) {
return Q.Promise(function (fulfill, reject, progress) {
module.exports = function (archive, dest, options) {
return when.promise(function (fulfill, reject, progress) {

if (options === undefined) {
options = {};
Expand Down Expand Up @@ -44,5 +44,5 @@ module.exports = function (archive, dest, options, cb) {
reject(err);
});

}).nodeify(cb);
})
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"homepage": "http://quentinrossetti.github.io/node-7zip",
"dependencies": {
"q": "^2.0.2",
"when": "^3.4.4",
"win-spawn": "^2.0.0"
},
"devDependencies": {
Expand Down
7 changes: 0 additions & 7 deletions test/util/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,4 @@ describe('Util: `run`', function () {
});
});

it('should work as Node.js-style callback', function (done) {
run(0, function (err) {
expect(err.message).to.be.a('string');
done();
});
});

});
8 changes: 4 additions & 4 deletions util/run.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';
var os = require('os');
var spawn = require('win-spawn');
var Q = require('q');
var when = require('when');

/**
* @promise Run
Expand All @@ -10,8 +10,8 @@ var Q = require('q');
* @reject {Error} The error issued by 7-Zip.
* @reject {number} Exit code issued by 7-Zip.
*/
module.exports = function (command, cb) {
return Q.Promise(function (fulfill, reject, progress) {
module.exports = function (command) {
return when.promise(function (fulfill, reject, progress) {

// Parse the command variable. If the command is not a string reject the
// Promise. Otherwise transform the command into two variables: the command
Expand Down Expand Up @@ -41,5 +41,5 @@ module.exports = function (command, cb) {
reject(err, code);
});

}).nodeify(cb);
});
};

0 comments on commit 1a10869

Please sign in to comment.