npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@shibam/sticker-maker

v1.1.14

Published

A package for creating stickers

Downloads

24

Readme

@shibam/sticker-maker

@shibam/sticker-maker is a lightweight utility library designed for converting images and videos into stickers while allowing customization of metadata. you don't have to download ffmpeg in terminal. It supports various input types and ensures high-quality sticker conversion. This module has minimal dependencies, ensuring efficient performance. If you encounter any issues, please feel free to open an issue. However, please check if a similar issue has already been reported before creating a new one. Happy Coding (⁠≧⁠▽⁠≦⁠).

Sticker Class

The Sticker class is a utility for converting images and videos into sticker format, with options for metadata customization and manipulation.

Installation

You can install the package using npm:

npm install @shibam/sticker-maker

Usage

Here's how you can use the Sticker class:

import fs from "fs";
import { Readable } from "stream";
import { Sticker, StickerTypes } from "@shibam/sticker-maker";

// Example 1: Create a new sticker instance and convert to buffer
const sticker = new Sticker("path/to/image.png", {
  pack: "My Sticker Pack",
  author: "Shibam",
  id: "123467890",
  category: ['😂','😹'],
  type: StickerTypes.DEFAULT,
  quality: 30,
});

try {
  const buffer = await sticker.toBuffer();
  console.log("Sticker converted to buffer:", buffer);
} catch (error) {
  console.error("Error converting sticker to buffer:", error);
}

// Example 2: Create a new sticker instance and convert to file
const sticker2 = new Sticker("path/to/another/image.png", {
  pack: "Another Sticker Pack",
  author: "John Doe",
  id: "987654321",
  category: ['😊','👍'],
  type: StickerTypes.CIRCLE,
  quality: 50,
});

try {
  await sticker2.toFile("path/to/output.webp");
  console.log("Sticker converted and saved to file successfully.");
} catch (error) {
  console.error("Error converting sticker to file:", error);
}

Class: Sticker

Constructor

new Sticker(data: Buffer | string | Readable, metaInfo?: Partial<MetaDataType>)
  • data: Input data for the sticker. Can be a Buffer, file path as a string, or Readable stream.
  • metaInfo (optional): Metadata about the sticker.

Methods

toBuffer(): Promise<Buffer>

Converts input data to a Buffer containing the converted sticker content.

toFile(outputPath: string): Promise<void>

Converts input data and writes the converted sticker to a file at outputPath.

changeMetaInfo(newMetaInfo: Partial<any>): Promise<any | undefined>

Updates metadata information with newMetaInfo and applies changes to the sticker.

extractMetaData(data: Buffer): Promise<any>

Extracts metadata from data and returns the extracted information.

Types

StickerTypes

An enum specifying different types of stickers:

enum StickerTypes {
  DEFAULT,
  CIRCLE,
  SQUARE,
}

License

This package is licensed under the MIT License.

Contributing

Contributions are welcome. Feel free to open issues or submit pull requests on GitHub.


This README provides an overview of the Sticker class functionalities, installation instructions, examples of usage, information about types used, and guidelines for contributing to the project. Adjust paths and additional details based on your actual implementation and repository setup.