
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
The typedarray package provides a polyfill for TypedArray functionality that is available in modern browsers. It allows for the manipulation of binary data in a similar way to how it's done in native implementations.
Buffer creation
This feature allows for the creation of a buffer with a specified size. In this case, a Uint8Array with 1024 bytes is created.
var typedarray = require('typedarray');
var uint8 = new typedarray.Uint8Array(1024);
Buffer manipulation
This feature allows for the manipulation of the buffer's contents. Here, the first byte is set to 255 and the second byte to 0.
var typedarray = require('typedarray');
var buffer = new typedarray.Uint8Array(2);
buffer[0] = 255;
buffer[1] = 0;
Buffer slicing
This feature allows for the slicing of the buffer, creating a new view of the original buffer without copying the underlying memory. In this example, a slice from the second byte to the third byte is created.
var typedarray = require('typedarray');
var buffer = new typedarray.Uint8Array(4);
var slice = buffer.subarray(1, 3);
The 'buffer' package provides similar functionality for handling binary data in Node.js. It is a Node.js core module, so it's more commonly used and has a broader API than 'typedarray'.
TypedArray polyfill ripped from this module.
var Uint8Array = require('typedarray').Uint8Array;
var ua = new Uint8Array(5);
ua[1] = 256 + 55;
console.log(ua[1]);
output:
55
var TA = require('typedarray')
The TA
object has the following constructors:
With npm do:
npm install typedarray
To use this module in the browser, compile with browserify or download a UMD build from browserify CDN:
http://wzrd.in/standalone/typedarray@latest
MIT
v0.0.7 - 2022-10-12
2e83ef6
592fe17
c5a4998
auto-changelog
c77cc4a
5a874a6
funding
in package.json 5421bfb
npmignore
to autogenerate an npmignore file 85f441b
c7cee04
bd1ee94
tape
8aaa43b
safe-publish-latest
809caf9
aud
in posttest
c8f7ac5
FAQs
TypedArray polyfill for old browsers
The npm package typedarray receives a total of 19,068,304 weekly downloads. As such, typedarray popularity was classified as popular.
We found that typedarray demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.