Data.ArrayBuffer.ArrayBuffer
- Package
- purescript-arraybuffer
- Repository
- jacereda/purescript-arraybuffer
#create Source
create :: ByteLength -> Effect ArrayBuffer
Create an ArrayBuffer
with the given capacity.
#byteLength Source
byteLength :: ArrayBuffer -> ByteLength
Represents the length of an ArrayBuffer
in bytes.
#slice Source
slice :: ByteOffset -> ByteOffset -> ArrayBuffer -> Effect ArrayBuffer
Returns a new ArrayBuffer
whose contents are a copy of this ArrayBuffer's bytes from begin, inclusive, up to end, exclusive.
#fromArray Source
fromArray :: Array Number -> ArrayBuffer
Convert an array into an ArrayBuffer
representation.
#fromIntArray Source
fromIntArray :: Array Int -> ArrayBuffer
Convert an array into an ArrayBuffer
representation.
#fromString Source
fromString :: String -> ArrayBuffer
Convert a String
into a UTF-8 encoded ArrayBuffer
.
Serves as a quick utility function for a common use-case. For more use-cases,
see: purescript-text-encoding
Requires the TextDecoder class available. A polyfill can be found in the npm package "text-encoding"
#decodeToString Source
decodeToString :: ArrayBuffer -> Either Error String
Convert a UTF-8 encoded ArrayBuffer
into a String
.
Serves as a quick utility function for a common use-case. For more use-cases,
see: purescript-text-encoding
Requires the TextDecoder class available. A polyfill can be found in the npm package "text-encoding"