New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dirmage

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dirmage - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

20

cli.js

@@ -33,2 +33,7 @@ #!/usr/bin/env node

type: 'boolean',
})
.option('a', {
alias: 'avoid',
describe: 'Avoid specific suffix',
type: 'string',
}).argv

@@ -40,9 +45,12 @@

}
dirmages(argv.dir, { width: argv.w, heigth: argv.h, suffix: argv.s }).then(
() => {
if (!argv.quiet) {
spinner.succeed(`Transforming images done`)
}
dirmages(argv.dir, {
width: argv.w,
heigth: argv.h,
suffix: argv.s,
avoidRepeat: argv.a.trim() === '' ? true : argv.a.trim(),
}).then((total) => {
if (!argv.quiet) {
spinner.succeed(`Transformed ${total} images successfully`)
}
)
})
}

@@ -8,4 +8,11 @@ const readdirp = require('readdirp')

dir,
{ width = null, heigth = null, options = {}, suffix = '-alt' } = {}
{
width = null,
heigth = null,
options = {},
suffix = '-alt',
avoidRepeat = false,
} = {}
) {
let total = 0
try {

@@ -18,5 +25,16 @@ for await (const { fullPath } of readdirp(dir)) {

const dest = join(dir, `${name}${suffix}${ext}`)
await sharp(fullPath).resize(width, heigth, options).toFile(dest)
if (
!avoidRepeat ||
(avoidRepeat &&
!name.endsWith(
typeof avoidRepeat === 'string' ? avoidRepeat : suffix
))
) {
await sharp(fullPath).resize(width, heigth, options).toFile(dest)
total++
}
}
}
return total
} catch (err) {

@@ -23,0 +41,0 @@ console.log(err)

{
"name": "dirmage",
"version": "1.0.0",
"version": "1.1.0",
"main": "index.js",

@@ -5,0 +5,0 @@ "author": "Lionel Tzatzkin <elrumordelaluz@hotmail.com> (https://elrumordelaluz.com/)",

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