# jest-serializer

> > DEPRECATED: Use `v8` APIs directly: https://nodejs.org/api/v8.html#serialization-api

Latest version **28.0.0** (published 2022-04-25) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install jest-serializer
pnpm add jest-serializer
yarn add jest-serializer
bun add jest-serializer
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 28.0.0 |
| Published | 2022-04-25 |
| First published | 2018-02-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | ^12.13.0 \|\| ^14.15.0 \|\| ^16.13.0 \|\| >=17.0.0 |
| Dependencies | 2 |
| Unpacked size | 6.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 45458 |
| Maintainers | scotthovestadt, rubennorte, simenb, fb, davidzilburg |

## Links

- npm: https://www.npmjs.com/package/jest-serializer
- Repository: https://github.com/facebook/jest
- Homepage: https://github.com/facebook/jest#readme
- Issues: https://github.com/facebook/jest/issues
- npm.io page: https://npm.io/package/jest-serializer

## Dependencies (2)

- [@types/node](https://npm.io/package/@types/node.md) *
- [graceful-fs](https://npm.io/package/graceful-fs.md) ^4.2.9

## Recent versions

- 28.0.0 (latest) — 2022-04-25
- 28.0.0-alpha.6 (next) — 2022-03-01
- 28.0.0-alpha.3 — 2022-02-17
- 28.0.0-alpha.2 — 2022-02-16
- 28.0.0-alpha.1 — 2022-02-15
- 28.0.0-alpha.0 — 2022-02-10
- 27.5.1 — 2022-02-08
- 27.5.0 — 2022-02-05
- 27.4.0 — 2021-11-29
- 27.0.6 — 2021-06-28
- 27.0.1 — 2021-05-25
- 27.0.0-next.9 — 2021-05-04
- 27.0.0-next.0 — 2020-12-05
- 26.6.2 — 2020-11-02
- 26.5.0 — 2020-10-05
- … 48 more at https://npm.io/package/jest-serializer/versions

## README

# jest-serializer

> DEPRECATED: Use `v8` APIs directly: https://nodejs.org/api/v8.html#serialization-api

Module for serializing and deserializing object into memory and disk. The Node core `v8` implementations are used. This seriializer have the advantage of being able to serialize `Map`, `Set`, `undefined`, `NaN`, etc..

## Install

```sh
$ yarn add jest-serializer
```

## API

Three kinds of API groups are exposed:

### In-memory serialization: `serialize` and `deserialize`

This set of functions take or return a `Buffer`. All the process happens in memory. This is useful when willing to transfer over HTTP, TCP or via UNIX pipes.

```javascript
import {deserialize, serialize} from 'jest-serializer';

const myObject = {
  foo: 'bar',
  baz: [0, true, '2', [], {}],
};

const buffer = serialize(myObject);
const myCopyObject = deserialize(buffer);
```

### Synchronous persistent filesystem: `readFileSync` and `writeFileSync`

This set of functions allow to send to disk a serialization result and retrieve it back, in a synchronous way. It mimics the `fs` API so it looks familiar.

```javascript
import {readFileSync, writeFileSync} from 'jest-serializer';

const myObject = {
  foo: 'bar',
  baz: [0, true, '2', [], {}],
};

const myFile = '/tmp/obj';

writeFileSync(myFile, myObject);
const myCopyObject = readFileSync(myFile);
```

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