Module

Node.Buffer.Immutable

Immutable buffers and associated operations.

#ImmutableBuffer

data ImmutableBuffer :: Type

An immutable buffer that exists independently of any memory region or effect.

Instances

#create

create :: Int -> ImmutableBuffer

Creates a new buffer of the specified size.

#fromArray

fromArray :: Array Octet -> ImmutableBuffer

Creates a new buffer from an array of octets, sized to match the array.

#fromString

fromString :: String -> Encoding -> ImmutableBuffer

Creates a new buffer from a string with the specified encoding, sized to match the string.

#fromArrayBuffer

fromArrayBuffer :: ArrayBuffer -> ImmutableBuffer

Creates a buffer view from a JS ArrayByffer without copying data.

#read

read :: BufferValueType -> Offset -> ImmutableBuffer -> Number

Reads a numeric value from a buffer at the specified offset.

#readString

readString :: Encoding -> Offset -> Offset -> ImmutableBuffer -> String

Reads a section of a buffer as a string with the specified encoding.

#toString

toString :: Encoding -> ImmutableBuffer -> String

Reads the buffer as a string with the specified encoding.

#toArray

toArray :: ImmutableBuffer -> Array Octet

Creates an array of octets from a buffer's contents.

#toArrayBuffer

toArrayBuffer :: ImmutableBuffer -> ArrayBuffer

Creates an ArrayBuffer by copying a buffer's contents.

#getAtOffset

getAtOffset :: Offset -> ImmutableBuffer -> Maybe Octet

Reads an octet from a buffer at the specified offset.

#concat

concat :: Array ImmutableBuffer -> ImmutableBuffer

Concatenates a list of buffers.

#concat'

concat' :: Array ImmutableBuffer -> Int -> ImmutableBuffer

Concatenates a list of buffers, combining them into a new buffer of the specified length.

#slice

slice :: Offset -> Offset -> ImmutableBuffer -> ImmutableBuffer

Creates a new buffer slice that shares the memory of the original buffer.

#size

size :: ImmutableBuffer -> Int

Returns the size of a buffer.

Modules