Socket
Socket
Sign inDemoInstall

avif

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

avif - npm Package Compare versions

Comparing version 0.5.1 to 0.5.2

2

bin/avif.js

@@ -12,2 +12,3 @@ #!/usr/bin/env node

chromaSubsampling,
keepMetadata,
overwrite,

@@ -41,2 +42,3 @@ appendExt,

chromaSubsampling,
keepMetadata,
overwrite,

@@ -43,0 +45,0 @@ appendExt,

@@ -38,2 +38,7 @@ const yargs = require("yargs");

})
.option("keep-metadata", {
type: "boolean",
default: false,
description: "Keep all metadata (EXIF, ICC, XMP, IPTC)",
})
.option("overwrite", {

@@ -40,0 +45,0 @@ type: "boolean",

14

lib/convert.js

@@ -12,2 +12,3 @@ const fs = require("fs").promises;

chromaSubsampling,
keepMetadata,
overwrite,

@@ -39,5 +40,12 @@ appendExt,

try {
await sharp(input)
.avif({ quality, effort, lossless, chromaSubsampling })
.toFile(outputPath);
const pipeline = sharp(input).avif({
quality,
effort,
lossless,
chromaSubsampling,
});
if (keepMetadata) {
pipeline.keepMetadata();
}
await pipeline.toFile(outputPath);
if (verbose) {

@@ -44,0 +52,0 @@ process.stdout.write(`${input}: created ${outputPath}\n`);

{
"name": "avif",
"version": "0.5.1",
"version": "0.5.2",
"description": "Command line utility to convert images to AVIF",

@@ -28,8 +28,8 @@ "author": "Lovell Fuller <npm@lovell.info>",

"glob": "^10.3.10",
"sharp": "^0.33.0",
"sharp": "^0.33.2",
"yargs": "^17.7.2"
},
"devDependencies": {
"prettier": "^3.1.0"
"prettier": "^3.2.4"
}
}
# avif-cli
Command line utility to convert images to AVIF, requires Node.js 14.15.0+
Command line utility to convert images to AVIF,
requires a Node-API v9 compatible runtime:
- Node.js 18.17.0+
- Deno
- Bun
## Usage

@@ -28,2 +33,3 @@

```
### Bun

@@ -36,5 +42,6 @@

### yarn
```sh
yarn dlx avif
```
yarn_node_linker=pnpm yarn dlx avif
```

@@ -56,2 +63,4 @@ ## Options

[string] [choices: "4:2:0", "4:4:4"] [default: "4:4:4"]
--keep-metadata Keep all metadata (EXIF, ICC, XMP, IPTC)
[boolean] [default: false]
--overwrite Allow existing output files to be overwritten

@@ -78,3 +87,3 @@ [boolean] [default: false]

```sh
npx avif --input="images/*.*" --effort=0 --quality=30
npx avif --input="images/*.*" --effort=0 --quality=30 --keep-metadata
```
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