ghcjs-base- base library for GHCJS

Safe HaskellNone




GHCJS implements the ByteArray# primitive with a JavaScript object containing an ArrayBuffer and various TypedArray views. This module contains utilities for manipulating and converting the buffer as a JavaScript object.

None of the properties of a Buffer object should be written to in foreign code. Changing the contents of a MutableBuffer in foreign code is allowed.



type Buffer = SomeBuffer Immutable Source #

createFromArrayBuffer :: SomeArrayBuffer any -> SomeBuffer any Source #

JavaScript properties

getArrayBuffer :: SomeBuffer any -> SomeArrayBuffer any Source #

getUint8Array :: SomeBuffer any -> SomeUint8Array any Source #

getUint16Array :: SomeBuffer any -> SomeUint16Array any Source #

getInt32Array :: SomeBuffer any -> SomeInt32Array any Source #

getDataView :: SomeBuffer any -> SomeDataView any Source #

getFloat32Array :: SomeBuffer any -> SomeFloat32Array any Source #

getFloat64Array :: SomeBuffer any -> SomeFloat64Array any Source #



toByteString :: Int -> Maybe Int -> Buffer -> ByteString Source #

Wrap a Buffer into a ByteString using the given offset and length.

fromByteString :: ByteString -> (Buffer, Int, Int) Source #

Convert a ByteString into a triple of (buffer, offset, length) Warning: if the ByteString's internal ForeignPtr has a finalizer associated with it, the returned Buffer will not count as a reference for the purpose of determining when that finalizer should run.