Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
available-typed-arrays
Advanced tools
Returns an array of Typed Array names that are available in the current environment
The available-typed-arrays npm package provides a simple way to list all available typed array constructors in the current environment. This can be particularly useful for applications that need to work with binary data in a way that is compatible across different platforms and JavaScript environments. It helps in identifying which typed arrays are supported, allowing developers to write more adaptable and robust code.
Listing available typed arrays
This feature allows you to retrieve an array of strings representing the names of all available typed array constructors. The code sample demonstrates how to use the package to get the list of available typed arrays and then log them to the console.
const availableTypedArrays = require('available-typed-arrays');
const typedArrays = availableTypedArrays();
console.log(typedArrays);
The 'typedarray' package provides a polyfill for TypedArray functionality for older browsers that do not support the latest JavaScript standards. While 'available-typed-arrays' helps in identifying available typed arrays in the environment, 'typedarray' aims to fill the gap by providing the functionality itself when it's not natively available. This makes 'typedarray' more focused on compatibility and polyfilling, whereas 'available-typed-arrays' is more about detection and adaptability.
The 'buffer' package is a node.js library for binary data manipulation. It provides a way to work with binary data through a Buffer class, which is similar to the typed arrays in JavaScript. While 'buffer' is more about providing a comprehensive set of tools for binary data manipulation, 'available-typed-arrays' focuses on identifying which typed array constructors are available in the current environment. 'buffer' can be seen as complementary to 'available-typed-arrays' for applications that need both data manipulation and environment adaptability.
Returns an array of Typed Array names that are available in the current environment.
var availableTypedArrays = require('available-typed-arrays');
var assert = require('assert');
assert.deepStrictEqual(
availableTypedArrays().sort(),
[
'Int8Array',
'Uint8Array',
'Uint8ClampedArray',
'Int16Array',
'Uint16Array',
'Int32Array',
'Uint32Array',
'Float32Array',
'Float64Array',
'BigInt64Array',
'BigUint64Array'
].sort()
);
Simply clone the repo, npm install
, and run npm test
FAQs
Returns an array of Typed Array names that are available in the current environment
The npm package available-typed-arrays receives a total of 30,446,729 weekly downloads. As such, available-typed-arrays popularity was classified as popular.
We found that available-typed-arrays demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.