https://github.com/danielesteban/imgpocket
Encode/Decode magic data pockets inside images
https://github.com/danielesteban/imgpocket
Last synced: over 1 year ago
JSON representation
Encode/Decode magic data pockets inside images
- Host: GitHub
- URL: https://github.com/danielesteban/imgpocket
- Owner: danielesteban
- License: mit
- Created: 2023-09-16T23:37:46.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-09-18T15:04:12.000Z (almost 3 years ago)
- Last Synced: 2025-03-16T23:21:37.882Z (over 1 year ago)
- Language: TypeScript
- Homepage:
- Size: 21.5 KB
- Stars: 15
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
imgpocket
[](https://www.npmjs.com/package/imgpocket)
==
> Encode/Decode magic data pockets inside images
### Example
[https://codesandbox.io/s/imgpocket-x8jl2q](https://codesandbox.io/s/imgpocket-x8jl2q)
### Installation
```bash
npm i imgpocket
```
### Usage
```js
import { encodeString, decodeString } from 'imgpocket';
// Encode:
const output = await encodeString(inputImage, JSON.stringify({ some: 'data' }));
output.toBlob((blob) => {
window.open(URL.createObjectURL(blob));
});
// Decode:
const decoded = JSON.parse(await decodeString(encodedImage));
console.log(decoded); // { some: 'data' }
```