mirror of
https://github.com/lovell/sharp.git
synced 2026-02-04 05:36:18 +01:00
Add support for Promises/A+ #33
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
/*jslint node: true */
|
||||
/*jslint es5: true */
|
||||
'use strict';
|
||||
|
||||
var sharp = require("../index");
|
||||
var path = require("path");
|
||||
var imagemagick = require("imagemagick");
|
||||
@@ -236,6 +240,18 @@ async.series([
|
||||
done();
|
||||
});
|
||||
});
|
||||
},
|
||||
// Promises/A+
|
||||
function(done) {
|
||||
sharp(inputJpg).resize(320, 240).toFile(outputJpg).then(function() {
|
||||
imagemagick.identify(outputJpg, function(err, features) {
|
||||
assert.strictEqual(320, features.width);
|
||||
assert.strictEqual(240, features.height);
|
||||
done();
|
||||
});
|
||||
}).catch(function(err) {
|
||||
throw err;
|
||||
});
|
||||
}
|
||||
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user