mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 18:40:16 +02:00
Merge pull request #51 from jonathanong/deprecate-write
show deprecation warning for .write()
This commit is contained in:
commit
4ae22b3425
3
index.js
3
index.js
@ -2,6 +2,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var Promise = require('bluebird');
|
var Promise = require('bluebird');
|
||||||
|
var deprecate = require('util-deprecate');
|
||||||
var sharp = require('./build/Release/sharp');
|
var sharp = require('./build/Release/sharp');
|
||||||
|
|
||||||
var Sharp = function(input) {
|
var Sharp = function(input) {
|
||||||
@ -163,7 +164,7 @@ Sharp.prototype.toFile = function(output, callback) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Deprecated to make way for future stream support - remove in v0.6.0
|
// Deprecated to make way for future stream support - remove in v0.6.0
|
||||||
Sharp.prototype.write = Sharp.prototype.toFile;
|
Sharp.prototype.write = deprecate(Sharp.prototype.toFile, '.write() is deprecated and will be removed in v0.6.0. Use .toFile() instead.');
|
||||||
|
|
||||||
Sharp.prototype.toBuffer = function(callback) {
|
Sharp.prototype.toBuffer = function(callback) {
|
||||||
return this._sharp('__input', callback);
|
return this._sharp('__input', callback);
|
||||||
|
@ -32,7 +32,8 @@
|
|||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"nan": "^1.1.2",
|
"nan": "^1.1.2",
|
||||||
"bluebird": "^1.2.4"
|
"bluebird": "^1.2.4",
|
||||||
|
"util-deprecate": "^1.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"imagemagick": "^0.1.3",
|
"imagemagick": "^0.1.3",
|
||||||
|
@ -219,7 +219,7 @@ async.series([
|
|||||||
},
|
},
|
||||||
// Do not enlarge the output if the input width is already less than the output width
|
// Do not enlarge the output if the input width is already less than the output width
|
||||||
function(done) {
|
function(done) {
|
||||||
sharp(inputJpg).resize(2800).withoutEnlargement().write(outputJpg, function(err) {
|
sharp(inputJpg).resize(2800).withoutEnlargement().toFile(outputJpg, function(err) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
imagemagick.identify(outputJpg, function(err, features) {
|
imagemagick.identify(outputJpg, function(err, features) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
@ -231,7 +231,7 @@ async.series([
|
|||||||
},
|
},
|
||||||
// Do not enlarge the output if the input height is already less than the output height
|
// Do not enlarge the output if the input height is already less than the output height
|
||||||
function(done) {
|
function(done) {
|
||||||
sharp(inputJpg).resize(null, 2300).withoutEnlargement().write(outputJpg, function(err) {
|
sharp(inputJpg).resize(null, 2300).withoutEnlargement().toFile(outputJpg, function(err) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
imagemagick.identify(outputJpg, function(err, features) {
|
imagemagick.identify(outputJpg, function(err, features) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user