Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

node-weakauras-parser

2.0.2 • Public • Published

node-weakauras-parser

Installation

npm install node-weakauras-parser
# or 
yarn add node-weakauras-parser

The package is pre-built for the following environments:

OS Node 8 Node 10 Node 12 Node 13
Linux glibc (x64) ✔️ ✔️ ✔️ ✔️
Linux musl-libc (x64) ✔️ ✔️ ✔️ ✔️
macOS (x64) ✔️ ✔️ ✔️ ✔️
Windows (x64) ✔️ ✔️ ✔️ ✔️

If you use something else, you will need Rust and zlib in order to build from source code.

Usage

Non-blocking version:

const parser = require('node-weakauras-parser');
 
(async function() {
    const source = { test: 1 };
    const encoded = await parser.encode(source);
    const decoded = await parser.decode(encoded);
 
    console.log(JSON.stringify(source) === JSON.stringify(decoded));
}());

Blocking version (slightly faster, but blocks the event loop):

const parser = require('node-weakauras-parser');
 
const source = { test: 1 };
const encoded = parser.encodeSync(source);
const decoded = parser.decodeSync(encoded);
 
console.log(JSON.stringify(source) === JSON.stringify(decoded));

Please note that when arrays are involved, encoding them is lossy:

const parser = require('node-weakauras-parser');
 
(async function() {
    const source = { test: [true, false] };
    const encoded = await parser.encode(source);
    const decoded = await parser.decode(encoded);
 
    // Prints "{ test: { 1: true, 2: false } }"
    console.log(decoded);
}());

License

The project is licensed under MIT License, unless stated otherwise in a source file.

Install

npm i [email protected]

Version

2.0.2

License

MIT

Unpacked Size

101 kB

Total Files

35

Last publish

Collaborators

  • avatar