Skip to content

procxy / SerializationMode

Type Alias: SerializationMode

ts
type SerializationMode = "json" | "advanced";

Defined in: src/types/options.ts:18

Serialization mode for IPC messages exchanged between parent and child processes.

Remarks

Choosing the right mode is a performance and capability trade-off:

  • 'json': Uses JSON.stringify / JSON.parse. Fast for plain objects and primitives. Silent data loss for undefined, NaN, Infinity, Date, Map, Set, functions, and Buffer — these are coerced or dropped by JSON encoding.
  • 'advanced': Uses Node.js V8 structured clone (the same algorithm as postMessage). Preserves binary types, collections, and special primitives at the cost of slightly higher serialization overhead. Required for Buffer, TypedArray, Map, Set, BigInt, Date, RegExp, and Error values that must survive the IPC boundary intact.

Released under the MIT License.