layout | description |
---|---|
page |
Stringify and parse JavaScript values according to Structured Clone Algorithm.
|
Stringify and parse JavaScript values according to Structured Clone Algorithm.
- Table of Contents {:toc .large-only}
This allows sending more advanced JS types across the network, including Date
, Map
, Set
, ArrayBuffer
and various typed arrays.
See https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm for more.
import * as Structured from '@worker-tools/structured-json'
The module exposes these functions:
Structured.stringify
Structured.parse
Structured.toJSON
Structured.fromJSON
This module supports File
, Blob
and FileList
, however use of stringifyAsync
or toJSONAsync
is required if your data contains any of these.
{:style="margin: 2rem 0"}
Links:
GitHub
| ghuc.cc
· NPM
| Browse Package
· deno.land
| Docs
{:.faded}