GitXplorerGitXplorer
l

meta-png

public
27 stars
3 forks
2 issues

Commits

List of commits on branch main.
Unverified
b9a79d98157af06875c3355f4c460ffb2963c25c

Release 1.0.6

llucach committed 2 years ago
Unverified
6532a7451a78dbd47f6cffe7e6852c4a00028392

Properly compute the CRC of the added chunk

llucach committed 2 years ago
Unverified
0f7ad4e568974ab625a3083557d8572b8a6354f0

Release 1.0.5

llucach committed 2 years ago
Unverified
928303dd42be15661f8eb684208c052b66b3dcd7

Fix incompatibilities with Node.js Buffer

llucach committed 2 years ago
Unverified
3676603d235da2717b126d694b9a97287f560382

Release 1.0.4

llucach committed 2 years ago
Unverified
4777f10a978832d822c85ed7d3ba4c971d300f37

Fix PNG detection for small Buffer

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.