Socket
Socket
Sign inDemoInstall

asset-converter

Package Overview
Dependencies
186
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    asset-converter

Boost your web performance by converting and optimizing image assets with this robust Node.js tool.


Version published
Weekly downloads
1
Maintainers
2
Created
Weekly downloads
 

Readme

Source

Asset Converter

Asset Converter is a Node.js package that converts and optimizes image assets. It converts PNG and JPEG images to WebP format and generates lower-resolution versions of the images.

Features

  • Converts PNG images to WebP format
  • Converts JPEG images to WebP format
  • Generates lower-resolution versions of images
  • Supports recursive optimization of images in a folder tree
  • Automatically creates parent folders if necessary

Prerequisites

Before using the Asset Converter package, make sure you have the following prerequisites installed on your system:

  • Node.js (v14 or higher)
  • npm (Node Package Manager)

If you don't have Node.js and npm installed, you can download and install them from the official Node.js website: https://nodejs.org

Installation

To install the Asset Converter package, use npm:

#!/bin/bash
npm install asset-converter

Usage

After installing the package, you can use it as a command-line tool:

#!/bin/bash
npx asset-converter [PATH] [FLAGS]

Replace [PATH] with the path to the directory or image file you want to convert.

Flags

You can use the following flags with the Asset Converter package:

  • -r : Optimize images in the whole folder tree, create low-dpi and webp versions, and create a parent folder if necessary.
  • -o : Optimize an image or the images contained in a folder without creating a new parent folder.
  • -u : Optimizes the image if it is not already optimized and creates or replaces a new WebP and lowdpi version.
  • -f : Forces the execution of the command even if the image is already optimized.

Examples:

  • Optimize images in the whole folder tree, creating low-dpi and webp versions, and creating a parent folder if necessary:
#!/bin/bash
npx asset-converter /path/to/images -r
  • Optimize a single image or multiple images in a folder without creating a new parent folder:
#!/bin/bash
npx asset-converter /path/to/image.jpg -o
  • Optimize images in the whole folder tree, creating low-dpi and webp versions, and optimize an image or images contained in a folder without creating a new parent folder:
#!/bin/bash
npx asset-converter /path/to/images -or

In the first example, the command will optimize the images in the specified folder and its subfolders, create low-dpi and webp versions, and create a parent folder if necessary.

In the second example, the command will optimize a single image or multiple images in a folder without creating a new parent folder.

In the third example, the command will optimize the images in the specified folder and its subfolders, create low-dpi and webp versions, and optimize a single image or multiple images in a folder without creating a new parent folder.

Help

If you need assistance with the usage of the Asset Converter package, you can refer to the documentation or visit the project's repository for more information.

License

This software is licensed under the Creative Commons Attribution-NonCommercial (CC BY-NC) license.

You are free to:

  • Share: Copy and redistribute the software in any medium or format.
  • Adapt: Remix, transform, and build upon the software.

Under the following terms:

  • Attribution: You must give appropriate credit, provide a link to the license, and indicate if changes were made.
  • NonCommercial: You may not use the software for commercial purposes.

For more details about the license, please visit: https://creativecommons.org/licenses/by-nc/4.0/

Dependencies

This project uses the following packages:

Credits

This package was developed by:

We also want to thank the open-source community for their contributions and support.

Keywords

FAQs

Last updated on 28 Jul 2023

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc