Files
JavaScriptServices/samples/misc/NodeServicesExamples/Node/resizeImage.js
2016-06-07 17:46:42 +01:00

9 lines
314 B
JavaScript

var sharp = require('sharp');
module.exports = function(result, physicalPath, mimeType, maxWidth, maxHeight) {
// Invoke the 'sharp' NPM module, and have it pipe the resulting image data back to .NET
sharp(physicalPath)
.resize(maxWidth || null, maxHeight || null)
.pipe(result.stream);
}