Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

resize-with-sharp-or-jimp

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

resize-with-sharp-or-jimp - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

10

index.js
try {
const sharp = require("sharp");
module.exports = async ({ fromFileName, width, toFileName }) => {
await sharp(fromFileName).resize({ width }).toFile(toFileName);
module.exports = async ({ fromFileName, width, height, toFileName }) => {
await sharp(fromFileName)
.resize(width, height || undefined)
.toFile(toFileName);
};
} catch (e) {
const Jimp = require("jimp");
module.exports = async ({ fromFileName, width, toFileName }) => {
module.exports = async ({ fromFileName, width, height, toFileName }) => {
const file = await Jimp.read(fromFileName);
await file.resize(width, Jimp.AUTO).writeAsync(toFileName);
await file.resize(width, height || Jimp.AUTO).writeAsync(toFileName);
};
}

2

package.json
{
"name": "resize-with-sharp-or-jimp",
"version": "0.1.4",
"version": "0.1.5",
"description": "Resize images with sharp. Switch to the slower jimp if sharp cannot be installed",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc