Security News
New Proposed CISA Mandate Would Require Critical Infrastructure to Report Ransom Payments Within 24 Hours
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
sharp-image-conversion
Advanced tools
Sharp.js wrapper for single image resize, quality manipulation and format conversion and output to file or buffer
Weekly downloads
Readme
Sharp wrapper for single image resize, manipulation and format conversion then output to file or buffer.
npm install --save sharp-image-conversion
// instantiate (optional resizing will be applied to all output files/buffered data)
const ImageConverter = require('sharp-image-conversion')
const imageConverter = new ImageConverter('./filename.jpg', {
xLimit: 1920,
yLimit: 1080,
})
// convert to PNG and output to disk with specified image manipulation params (only the target path is required)
imageConverter.streamCopy(
'./newFilename.png',
'png',
{
compressionLevel: 5,
quality: 50,
})
// convert to webP and output to buffer, with no other alterations
imageConverter
.toBuffer('webp')
.then(buffer => {
// do something with the buffered image data
})
.catch(error => {
console.log(error)
})
creates an instance and specify the optional resizing parameter object in the format of:
const resizingOptions = {
xLimit: 1920, // optional
yLimit: 1080, // optional
}
Instance.streamCopy(targetFilePath : String, targetFormat? : String, outputOptions? : Object)
copy the file specified during instantiation using node.js stream after converting to the optionally specified image format with optionally appied image manipulation parameters
note 1: refer to Sharp docs for supported image formats.
note 2: specified outputOptions are ignored if targetFormat is undefined or null.
// output options are ignored in this case
instance.streamCopy('targetPath', undefined, {
option_1: blah_1,
option_2: blah_2,
})
note 3: outputOptions should match the targetFormat according to Sharp docs.
Instance.toBuffer(targetFormat? : String, outputOptions? : Object)
buffer the image data from the file specified during instantiation after converting to the optionally specified image format with optionally appied image manipulation parameters
see notes from Instance.StreamCopy method
MIT
FAQs
Sharp.js wrapper for single image resize, quality manipulation and format conversion and output to file or buffer
The npm package sharp-image-conversion receives a total of 1 weekly downloads. As such, sharp-image-conversion popularity was classified as not popular.
We found that sharp-image-conversion demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
Security News
Redis is no longer OSS, breaking its explicit commitment to remain under the BSD 3-Clause License forever. This has angered contributors who are now working to fork the software.
Product
Socket AI now enables 'AI detected potential malware' alerts by default, ensuring users benefit from AI-powered state-of-the-art malware detection without needing to opt-in.