Socket
Socket
Sign inDemoInstall

typedarray

Package Overview
Dependencies
0
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    typedarray

TypedArray polyfill for old browsers


Version published
Weekly downloads
18M
increased by2.49%
Maintainers
2
Install size
32.3 kB
Created
Weekly downloads
 

Package description

What is typedarray?

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.

What are typedarray's main functionalities?

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);

Other packages similar to typedarray

Changelog

Source

v0.0.7 - 2022-10-12

Commits

  • [eslint] fix indentation 2e83ef6
  • [eslint] add eslint 592fe17
  • [readme] rename, add badges c5a4998
  • [meta] add auto-changelog c77cc4a
  • [actions] add reusable workflows 5a874a6
  • [meta] create FUNDING.yml; add funding in package.json 5421bfb
  • [meta] use npmignore to autogenerate an npmignore file 85f441b
  • Only apps should have lockfiles c7cee04
  • [meta] update URLs bd1ee94
  • [Dev Deps] update tape 8aaa43b
  • [meta] add safe-publish-latest 809caf9
  • [Tests] add aud in posttest c8f7ac5

Readme

Source

typedarray Version Badge

github actions coverage License Downloads

npm badge

TypedArray polyfill ripped from this module.

build status

testling badge

example

var Uint8Array = require('typedarray').Uint8Array;
var ua = new Uint8Array(5);
ua[1] = 256 + 55;
console.log(ua[1]);

output:

55

methods

var TA = require('typedarray')

The TA object has the following constructors:

  • TA.ArrayBuffer
  • TA.DataView
  • TA.Float32Array
  • TA.Float64Array
  • TA.Int8Array
  • TA.Int16Array
  • TA.Int32Array
  • TA.Uint8Array
  • TA.Uint8ClampedArray
  • TA.Uint16Array
  • TA.Uint32Array

install

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

license

MIT

Keywords

FAQs

Last updated on 12 Oct 2022

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc