Security News
NIST Misses 2024 Deadline to Clear NVD Backlog
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
json-arraybuffer-reviver
Advanced tools
Utility functions for JSON.parse and JSON.stringify to work with typed arrays and array buffers.
Utility functions for JSON.parse and JSON.stringify to work with typed arrays and array buffers.
Install the library via NPM:
# npm install json-arraybuffer-reviver
Before you can use the functionality in your project, you need to import it to your project:
// Import the Price Oracle library.
import { replacer, reviver } from 'json-arraybuffer-reviver`;
When you need to JSON.stringify()
or JSON.parse()
data that contains ArrayBuffers
, DataViews
or BigInts
, simply pass in the replacer
and reviver
functions:
// Create some data to encode.
const inputData = new Uint8Array();
// Encode the data into JSON.
const encodedData = JSON.stringify(inputData, replacer);
// Decode the data from JSON.
const outputData = JSON.parse(encodedData, reviver);
The replacer function looks at the data that you are trying to encode into JSON and instead of using the default toString()
methods it encodes the data in a human readable form as follows:
{
$BigInt: 'The integer number as a string'
}
{
$ArrayBuffer:
{
View: "Name of the ArrayBuffer or DataView type, as a string",
Data: "Hexadecimal representation of the bytes that make up the ArrayBuffer",
}
}
Currently, Internet Explorer and Safari browsers do not support BigIntArrays.
The code for these utility functions was inspired by a gist by Jimmy Wärting, but rebuilt from scratch in order to be:
FAQs
Utility functions for JSON.parse and JSON.stringify to work with typed arrays and array buffers.
The npm package json-arraybuffer-reviver receives a total of 78 weekly downloads. As such, json-arraybuffer-reviver popularity was classified as not popular.
We found that json-arraybuffer-reviver demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.