mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-22 17:47:53 +00:00
Replace image resizing sample with chartist sample
This commit is contained in:
8
samples/misc/NodeServicesExamples/Node/renderChart.js
Normal file
8
samples/misc/NodeServicesExamples/Node/renderChart.js
Normal file
@@ -0,0 +1,8 @@
|
||||
var generate = require('node-chartist');
|
||||
|
||||
module.exports = function (callback, type, options, data) {
|
||||
generate(type, options, data).then(
|
||||
result => callback(null, result), // Success case
|
||||
error => callback(error) // Error case
|
||||
);
|
||||
};
|
||||
@@ -1,8 +0,0 @@
|
||||
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);
|
||||
}
|
||||
Reference in New Issue
Block a user