TypedArrays in JS
This is an implementation of the TypedArrays draft spec for Node.js. It requires at least Node.js 0.7.7.
makeFastBuffer. This is an
extended version of Node.js'
SlowBuffer.makeFastBuffer, to allow different
types of V8 ExternalArray property access.
The implementation passes the WebGL conformance tests, but there are subtle differences with the current Node.js implementation when it comes to smaller details outside the spec:
[object Object]. There doesn't appear to be an API to set the class name for Function instances in V8.
DataView in Node.js allowed construction using TypedArrays. This is outside the spec (and Chrome doesn't allow it either).
ArrayBufferViews in Node.js could be constructed from a Node.js Buffer. This is still possible, but transparently creates an ArrayBuffer backed by the Buffer.
ArrayBufferView#bufferwould erronously be a Buffer in this situation, which breaks the spec. The underlying Node.js Buffer is made available as
ArrayBufferView#nodeBuffer, of which the latter may be a slice matching the view.
There is no
TypedArray#setfor indexing. These are also not in the spec, but can be added, of course. Chrome doesn't have them.
There is no
TypedArray#slice, which is a Node.js extension that follows
Buffer#slicebehavior. The spec defines
slicein this way also goes a bit against the definition
ArrayBuffer#slice, which actually creates a copy.
Parts are © Joyent, © Khronos Group, and original work done here © Stéphan Kochen. All MIT licensed.