1.1.1 • Published 9 months ago

javascript-object-compress v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

javascript-object-compress

A tool for compressing JavaScript objects to Uint8Array

Usage

import {compress, decompress} from "javascript-opject-compress";

const obj = {
  a: 1,
  b: [2, 3],
  c: new Date(),
  d: new File([Uint8Array.from([1, 2, 3])], "file", {
    type: "text/plain"
  })
};

// Circular referencing is supported
obj.self = obj;

compress(obj).then(compressed => {
  const decompressed = decompress(compressed);
});

Supported types

  • string
  • number
  • bigint
  • boolean
  • undefined
  • null
  • Date
  • Int8Array
  • Uint8Array
  • Uint8ClampedArray
  • Int16Array
  • Uint16Array
  • Int32Array
  • Uint32Array
  • Float32Array
  • Float64Array
  • BigInt64Array
  • BigUint64Array
  • ArrayBuffer
  • File
  • Blob
  • Array
  • Object
  • Map
  • Set
1.1.1

9 months ago

1.1.0

9 months ago

1.0.0

9 months ago