1.0.2 • Published 7 months ago

image-placeholder-generator v1.0.2

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
7 months ago

Image Placeholder Generator

A simple Node.js package to generate base64-encoded image placeholders from an image file. Perfect for loading image placeholders in web applications.

Features

  • Generate a base64-encoded placeholder image from an input image.
  • Supports JPEG images (can be extended to other formats if necessary).
  • Easy to use as a CLI tool or library.

Installation

To use the image-placeholder-generator in your project, you can install it via npm:

npm install image-placeholder-generator 

Usage

As a Library You can use this package programmatically in your Node.js application.

javascript

const { generatePlaceholder } = require('image-placeholder-generator');

// Generate a base64 placeholder from an image
generatePlaceholder('./path/to/your/image.jpg')
  .then((placeholder) => {
    console.log('Generated base64 placeholder:', placeholder);
  })
  .catch((error) => {
    console.error('Error generating placeholder:', error);
  });

As a CLI Tool If you installed the package globally, you can use it from the command line.

  1. Install the package globally:
npm install -g image-placeholder-generator
  1. Run the CLI tool with an image file path as an argument:
generate-placeholder ./path/to/your/image.jpg

This will output the base64-encoded placeholder string.

Testing

To run the tests for this package, use Jest. First, make sure Jest is installed:

npm install --save-dev jest

Then, run the tests:

npm test

Contributing

We welcome contributions! If you'd like to improve the package, feel free to fork the repository and submit a pull request.

Steps for Contributing: 1. Fork this repository. 2. Clone your fork to your local machine. 3. Make your changes and test them. 4. Submit a pull request to the main repository.

License

This project is licensed under the Apache-2.0 License - see the LICENSE file for details.

If you encounter any issues or have suggestions, feel free to open an issue.

Breakdown of the README Sections:

<<<<<<< HEAD

  1. Title: Briefly describes the purpose of the package.
  2. Features: A quick overview of what your package does.
  3. Installation: Instructions for installing the package.
  4. Usage: Example code for using the package both as a library and CLI tool.
  5. Testing: Instructions for running tests with Jest.
  6. Contributing: Basic guidelines for contributing to the project.
  7. License: Licensing information.

Let me know if you want to customize it further!

=======

  1. Title: Briefly describes the purpose of the package.
  2. Features: A quick overview of what your package does.
  3. Installation: Instructions for installing the package.
  4. Usage: Example code for using the package both as a library and CLI tool.
  5. Testing: Instructions for running tests with Jest.
  6. Contributing: Basic guidelines for contributing to the project.
  7. License: Licensing information.

Let me know if you want to customize it further!

37791fb (Adding README and LICENSE)

1.0.2

7 months ago

1.0.1

8 months ago

1.0.0

8 months ago