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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@vali98/react-native-png-utils

v0.3.0

Published

react-native-png-utils provides utilities for PNG tEXt chunks

Readme

@vali98/react-native-png-utils

Native PNG text-chunk utilities and file-to-file audio conversion for React Native, using Nitro Modules. Android and iOS implementations share C++ interfaces.

Installation

npm install @vali98/react-native-png-utils react-native-nitro-modules

Rebuild the native app after installation. On iOS, run pod install.

PNG metadata

import {
  extractPngTextChunk,
  replacePngTextChunk,
} from '@vali98/react-native-png-utils'

const chunks = extractPngTextChunk(pngBase64, {
  keywords: ['chara'],
  decodeBase64: true,
})

const updated = replacePngTextChunk(pngBase64, [
  { keyword: 'chara', data: JSON.stringify(card), b64encode: true },
], { removeKeywords: ['obsolete'] })

Extraction returns { keyword, data }[]. Without a keyword filter it reads all tEXt chunks; base64 values are decoded by default when valid. Replacement removes existing chunks with matching keywords and inserts the supplied values. PNG pixel data is retained without decoding or recompression. Non-PNG image replacement uses STB to decode and convert the image to PNG. These methods are synchronous.

Audio to WAV

import { convertToWav } from '@vali98/react-native-png-utils'

const result = await convertToWav(inputFileUri, outputFileUri)
// { path, uri, sampleRate, channels, frames, durationSeconds, bytes }

Both arguments must be caller-provided local file:// URIs. The library does not choose a cache path. Copy content:// documents into app-local storage before conversion. The output directory must exist and the output file must not exist. result.uri is the supplied destination; result.path is its decoded filesystem path. No external-storage permissions are needed for app-private cache files.

There is no file-extension allowlist in the converter. It asks Android's NDK media APIs or Apple's AudioToolbox to decode the first/default audio track. MP3, M4A/AAC and audio in MP4 are the primary use cases. Other formats are attempted using the same path; support depends on the OS decoder and container reader. The current Apple AudioToolbox backend does not accept the included WebM/Opus fixture. WebM support is therefore not guaranteed across platforms. WebP is an image format and contains no audio.

Output is signed little-endian 16-bit PCM WAV, preserving the decoded sample rate and mono/stereo channel count. Multichannel audio, encrypted media, empty audio, midstream format changes and classic WAV output over 4 GiB are rejected. Conversion does not restore lossy source information or preserve 24/32-bit precision. There is no resampling, downmixing, track-selection or progress/cancellation option.

Conversion runs on Nitro's worker pool with bounded PCM buffers. It creates the requested file exclusively and removes incomplete output on failure. Wait for the promise before reading the WAV. Disk space still scales with duration: 48 kHz stereo 16-bit PCM uses about 11.5 MB per minute.

Example and development

The example app includes PNG benchmarks and an Audio → WAV screen with local file selection and generated test tones. Its audio output is result.wav in app cache; only the example chooses that path.

npm run build

After changing Nitro specs, run npx nitrogen and include its generated bindings in the change. Avoid the full codegen script unless you also intend to rebuild JS and install example iOS pods. See test instructions.

The package publishes source and native bindings, not example fixtures, tests, benchmark binaries or build directories.

Credits

Bootstrapped with create-nitro-module. PNG conversion uses STB; base64 conversion uses the bundled Turbo-Base64 implementation with ARM64 NEON selection.