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

zip-data-in-png

v1.1.1

Published

tweetable-polyglot-png in node.js

Downloads

1

Readme

tweetable-polyglot-png in js

Pack up to 3MB of data into a tweetable PNG polyglot file but in nodejs.

Original Repo: https://github.com/DavidBuchanan314/tweetable-polyglot-png

Install

yarn add zip-data-in-png
npm i zip-data-in-png

Status

Currently in beta, please do not use it in productions.

Features

  1. Fully Sync
  2. In typescript development
  3. Works in node.js (Not support web currently)

Why not in python but nodejs

I Don't know.

Normal Usage

zipDataInPng()

Hide a hello.zip into deno.png, and output the file named final.png

import path from "path";
import { zipDataInPng } from 'zip-data-in-png';

zipDataInPng (
    path.join(__dirname, "deno.png"),  // Original data
    path.join(__dirname, "hello.zip"), // .zip file to hide
    path.join(__dirname, "final.png") // Output file
)

pngAddHiddenContent()

Hide a hi.zip into cat.png, and return a Uint8Array png Buffer for save in hidden.png.

import fs from "fs";
import { pngAddHiddenContent } from 'zip-data-in-png';

const png_in = fs.readFileSync("cat.png", {flag:'r'});
const content_in = fs.readFileSync("hi.zip", {flag:'r'});

const result: Uint8Array = pngAddHiddenContent (
    png_in,         // Original data
    content_in,     // .zip file to hide
    { quiet: true } // Output file
)

fs.writeFileSync("hidden.png", result);

Sample

Hide a data.zip into deno.png, and output the file named result.png

import path from "path";
import { zipDataInPng } from 'zip-data-in-png';

zipDataInPng (
    path.join(__dirname, "deno.png"),   // Original data
    path.join(__dirname, "data.zip"),   // .zip file to hide
    path.join(__dirname, "result.png") // Output file
)

Notices:

  1. The input file MUST be a .png file.
  2. Hidden file MUST be a .zip file.
  3. If you see ERROR: Input files too big for cover image resolution., means the input .png resolution is too high.

Params

export function zipDataInPng(
    originalPngPath: string,
    inputContentPath: string,
    outputPath: string,
    option?: zipDataInPngOptions
) : boolean

export function pngAddHiddenContent(
    png_in: Buffer, // Png file
    content_in: Buffer, // Zip file
    option?: zipDataInPngOptions
): Uint8Array

interface zipDataInPngOptions {
    quiet: boolean // Default: false, if true then will console.log all info
}

Advance usage

import path from "path";
import { zipDataInPng } from 'zip-data-in-png';

zipDataInPng (
    path.join(__dirname, "deno.png"),   
    path.join(__dirname, "data.zip"),   
    path.join(__dirname, "result.png"), 
    { quiet: false }
)

Logs

1.1

  1. Adding function pngAddHiddenContent() for advance usage.