Module

Data.ByteArray

A wrapper over Uint8Array with extra utility functions

#byteArrayFromIntArray

byteArrayFromIntArray :: Array Int -> Maybe ByteArray

A safer version of byteArrayFromIntArrayUnsafe that checks that elements are in range 0-255.

#byteArrayFromIntArrayUnsafe

byteArrayFromIntArrayUnsafe :: Array Int -> ByteArray

Overflowing integers will be silently accepted modulo 256.

#byteArrayFromInt16ArrayUnsafe

#byteArrayFromAscii

byteArrayFromAscii :: String -> Maybe ByteArray

Convert characters in range 0-255 into a ByteArray. Fails with Nothing if there are characters out of this range in a string.

#byteArrayToHex

#byteArrayToIntArray

#byteLength

#hexToByteArray

hexToByteArray :: String -> Maybe ByteArray

Input string must consist of hexadecimal numbers. Length of the input string must be even (2 characters per byte).

#hexToByteArrayUnsafe

hexToByteArrayUnsafe :: String -> ByteArray

Characters not in range will be converted to zero.

#byteArrayToUTF16le

#subarray

subarray :: Int -> Int -> ByteArray -> ByteArray

Given a begin offset (inclusive) and end offset (exclusive), efficiently create a new ByteArray backed by the same underlying buffer.

Modules