jest-serializer
Module for serializing and deserializing object into memory and disk. By default, the `v8` implementations are used, but if not present, it defaults to `JSON` implementation. Both serializers have the advantage of being able to serialize `Map`, `Set`, `un
Last updated 4 years ago by simenb .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install jest-serializer 
SYNC missed versions from official npm registry.

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

$ 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.

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.

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);

Current Tags

  • 28.0.0                                ...           latest (3 years ago)
  • 28.0.0-alpha.6                                ...           next (3 years ago)

63 Versions

  • 28.0.0 [deprecated]           ...           3 years ago
  • 28.0.0-alpha.6 [deprecated]           ...           3 years ago
  • 28.0.0-alpha.3 [deprecated]           ...           3 years ago
  • 28.0.0-alpha.2 [deprecated]           ...           3 years ago
  • 28.0.0-alpha.1 [deprecated]           ...           3 years ago
  • 28.0.0-alpha.0 [deprecated]           ...           3 years ago
  • 27.5.1                                ...           3 years ago
  • 27.5.0                                ...           3 years ago
  • 27.4.0                                ...           3 years ago
  • 27.0.6                                ...           3 years ago
  • 27.0.1                                ...           3 years ago
  • 27.0.0-next.9                                ...           4 years ago
  • 27.0.0-next.0                                ...           4 years ago
  • 26.6.2                                ...           4 years ago
  • 26.5.0                                ...           4 years ago
  • 26.3.0                                ...           4 years ago
  • 26.2.0                                ...           4 years ago
  • 26.1.0                                ...           4 years ago
  • 26.0.0                                ...           5 years ago
  • 26.0.0-alpha.0                                ...           5 years ago
  • 25.5.0                                ...           5 years ago
  • 25.2.6                                ...           5 years ago
  • 25.2.1                                ...           5 years ago
  • 25.2.1-alpha.2                                ...           5 years ago
  • 25.2.1-alpha.1                                ...           5 years ago
  • 25.2.0                                ...           5 years ago
  • 25.2.0-alpha.86                                ...           5 years ago
  • 25.1.0                                ...           5 years ago
  • 25.0.0                                ...           5 years ago
  • 24.9.0                                ...           5 years ago
  • 24.4.0                                ...           6 years ago
  • 24.3.0                                ...           6 years ago
  • 24.2.0-alpha.0                                ...           6 years ago
  • 24.0.0                                ...           6 years ago
  • 24.0.0-alpha.16                                ...           6 years ago
  • 24.0.0-alpha.15                                ...           6 years ago
  • 24.0.0-alpha.13                                ...           6 years ago
  • 24.0.0-alpha.12                                ...           6 years ago
  • 24.0.0-alpha.11                                ...           6 years ago
  • 24.0.0-alpha.10                                ...           6 years ago
  • 24.0.0-alpha.9                                ...           6 years ago
  • 24.0.0-alpha.7                                ...           6 years ago
  • 24.0.0-alpha.6                                ...           6 years ago
  • 24.0.0-alpha.5                                ...           6 years ago
  • 24.0.0-alpha.4                                ...           6 years ago
  • 24.0.0-alpha.2                                ...           6 years ago
  • 24.0.0-alpha.1                                ...           6 years ago
  • 24.0.0-alpha.0                                ...           6 years ago
  • 23.0.1                                ...           6 years ago
  • 23.0.0                                ...           6 years ago
  • 23.0.0-charlie.4                                ...           6 years ago
  • 23.0.0-charlie.3                                ...           6 years ago
  • 23.0.0-charlie.2                                ...           7 years ago
  • 23.0.0-charlie.1                                ...           7 years ago
  • 23.0.0-charlie.0                                ...           7 years ago
  • 23.0.0-beta.3r                                ...           7 years ago
  • 23.0.0-alpha.3r                                ...           7 years ago
  • 23.0.0-beta.2                                ...           7 years ago
  • 23.0.0-beta.1                                ...           7 years ago
  • 23.0.0-beta.0                                ...           7 years ago
  • 23.0.0-alpha.7                                ...           7 years ago
  • 22.4.3                                ...           7 years ago
  • 22.4.0                                ...           7 years ago
Downloads
Total 2
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 2
Dependencies (2)
Dev Dependencies (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE