# @vercel/stega

> Utilities for steganography

Latest version **1.1.0** (published 2026-03-18) · MPL-2.0 license · 0 weekly downloads

## Install

```sh
npm install @vercel/stega
pnpm add @vercel/stega
yarn add @vercel/stega
bun add @vercel/stega
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2026-03-18 |
| First published | 2023-03-15 |
| Weekly downloads | 0 |
| License | MPL-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 25.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | vercel-release-bot, zeit-bot |

## Links

- npm: https://www.npmjs.com/package/@vercel/stega
- npm.io page: https://npm.io/package/@vercel/stega

## Recent versions

- 1.1.0 (latest) — 2026-03-18
- 1.0.0 — 2025-12-05
- 0.1.2 — 2024-05-02
- 0.1.1 — 2024-04-30
- 0.1.0 — 2023-07-12
- 0.0.5 — 2023-05-23
- 0.0.4 — 2023-04-25
- 0.0.3 — 2023-04-18
- 0.0.2 — 2023-03-15
- 0.0.1 — 2023-03-15

## README

# @vercel/stega

A simple [steganography](https://en.wikipedia.org/wiki/Steganography) library for adding hidden JSON data to strings.

## Usage

This package exports a few methods for encoding and decoding data. All of these methods have TypeScript type definitions and JSDoc comments explaining their parameters and return values.

### `vercelStegaCombine(string, json, skip = 'auto')`

This method combines a `string` with some JSON data and returns the result. The `json` can be any value that can be JSON stringified.

When the `skip` property is `true`, the original string will be returned without combining the `json`. It supports `boolean` values and `'auto'`. The default is `'auto'`, which will only skip encoding when the `string` is an ISO date string or a URL.

```js
vercelStegaCombine('Hello world', { foo: 'bar' });
// -> 'Hello world' (the JSON data is hidden in the new string)
```

### `vercelStegaEncode(json)`

This method encodes JSON data as a hidden string and returns the result. The `json` can be any value that can be JSON stringified.

```js
vercelStegaEncode({ foo: 'bar' });
// -> '' (the JSON data is hidden)
```

### `vercelStegaSplit(string)`

This method splits out the original string (cleaned) and the encoded portion of the string.

```js
// In 'Hello world' (the extra data is hidden)
vercelStegaSplit('Hello world');
/*
 * -> {
 *  cleaned: 'Hello world', // This doesn't contain the encoded data
 *  encoded: '', // This is not an empty string, it contains the encoded data
 * }
 */
```

### `vercelStegaClean(json)`

This method strips all encoded stega data from the value and returns the cleaned value. It accepts any JSON value.

```js
// In 'Hello world' (the extra data is hidden)
vercelStegaClean('Hello world');
/*
 * -> 'Hello world' // This doesn't contain the encoded data
 */

// In 'Hello world' (the extra data is hidden)
vercelStegaClean({
  nested: {
    value: 'Hello world',
  },
});
/*
 * -> { nested: { value: 'Hello world' } } // This doesn't contain the encoded data
 */
```

### `vercelStegaDecode(string)`

This method attempts to extract encoded JSON data from a `string`.

```js
// In 'Hello world' (the extra data is hidden)
vercelStegaDecode('Hello world');
// -> { foo: 'bar' }
```

---
_Source: https://npm.io/package/@vercel/stega · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
