GitXplorerGitXplorer
l

meta-png

public
27 stars
3 forks
2 issues

Commits

List of commits on branch main.
Unverified
abcd251573a53dc7d5cd03679178cf07db57777f

Release 1.0.3

llucach committed 2 years ago
Verified
ba8ea827deeae99a9feac6f3c2dc68e537a311cb

Merge pull request #3 from FRSgit/add-typings-and-repository-link

llucach committed 2 years ago
Verified
e1483e5e6839e681e8dd04749765e3e51fdb82f1

chore: link npm badge to npm page

FFRSgit committed 2 years ago
Verified
d63f3039edf0009460a90c75fa952a6608bde1a8

chore: publish typings and add repository link on the npm page

FFRSgit committed 2 years ago
Unverified
1d3d68b61d25676cc99e5126d64ec3baafed0b0a

Release 1.0.2

llucach committed 2 years ago
Unverified
3ea415b8c5cd82c6e23c26a6401d788caeb0f33c

Automatically build with release-it

llucach committed 2 years ago

README

The README file for this repository.

meta-png

NPM version codecov Test Lint

Simple, zero-dependencies NodeJS/JavaScript library to store and retrieve metadata in PNG files.

Installation

Use your favourite package manager

npm install meta-png
# or: yarn add meta-png

Usage

The library provides two functions to add a new metadata:

addMetadata(PNGUint8Array, key, value)  // stores the given key-value inside the PNG, provided as Uint8Array
addMetadataFromBase64DataURI(dataURI, key, value)  // stores the given key-value inside the PNG, provided as a Data URL string

and a function to get back the stored value:

getMetadata(PNGUint8Array, key)  // retrives the given key from a PNG provided as Uint8Array

Limitations

  • tEXt chunks inside PNG files are meant to use the Latin-1 standard: using characters outside this charset may lead to unwanted behaviors
  • No check is performed inside add functions to test whether a given key is already present in the file. If you need it, you can call getMetadata beforehand and assert that it gives back undefined.