Skip to content

Latest commit

 

History

History
44 lines (34 loc) · 1.44 KB

structured-json.md

File metadata and controls

44 lines (34 loc) · 1.44 KB
layout description
page
Stringify and parse JavaScript values according to Structured Clone Algorithm.

Structured JSON

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.

Usage

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}