to-array-buffer

WebJar for to-array-buffer

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

to-array-buffer
Last Version

Last Version

3.2.0
Release Date

Release Date

Type

Type

jar
Description

Description

to-array-buffer
WebJar for to-array-buffer
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/dy/to-array-buffer

Download to-array-buffer

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/to-array-buffer/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>to-array-buffer</artifactId>
    <version>3.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/to-array-buffer/
implementation 'org.webjars.npm:to-array-buffer:3.2.0'
// https://jarcasting.com/artifacts/org.webjars.npm/to-array-buffer/
implementation ("org.webjars.npm:to-array-buffer:3.2.0")
'org.webjars.npm:to-array-buffer:jar:3.2.0'
<dependency org="org.webjars.npm" name="to-array-buffer" rev="3.2.0">
  <artifact name="to-array-buffer" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='to-array-buffer', version='3.2.0')
)
libraryDependencies += "org.webjars.npm" % "to-array-buffer" % "3.2.0"
[org.webjars.npm/to-array-buffer "3.2.0"]

Dependencies

compile (3)

Group / Artifact Type Version
org.webjars.npm : flatten-vertex-data jar [1.0.2,2)
org.webjars.npm : is-blob jar [2.0.1,3)
org.webjars.npm : string-to-arraybuffer jar [1.0.0,2)

Project Modules

There are no modules declared in this project.

to-array-buffer unstable Build Status

Turn any binary data container into an ArrayBuffer in sync way. Detected containers:

  • Buffer
  • TypedArray
  • ArrayBufferView
  • ArrayBuffer
  • data-uri string
  • base64 string
  • plain string
  • Array
  • Array of Arrays
  • Number (creates new ArrayBuffer of the defined length in bytes)
  • etc.

It also handles some custom data types, like ImageData, AudioBuffer etc., but in general it returns null for objects not looking like binary data containers. Note also that it does not handle Blob and File, since they require async API.

npm install to-array-buffer

var toArrayBuffer = require('to-array-buffer')
var context = require('audio-context')

// Get array buffer from any object
ab = toArrayBuffer(new Buffer(100))
ab = toArrayBuffer(new Float32Array(12))
ab = toArrayBuffer(dataURIstr)
ab = toArrayBuffer(base64str)
ab = toArrayBuffer(ndarray)
ab = toArrayBuffer([[0, 1, 0], [1, 0, 1]])

Related

© Dmitry Yv 2018. MIT Licensed.

Versions

Version
3.2.0