Module

Node.Buffer.Immutable

Package
purescript-node-buffer
Repository
purescript-node/purescript-node-buffer

Immutable buffers and associated operations.

#ImmutableBuffer Source

data ImmutableBuffer

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

Instances

#create Source

create :: Int -> ImmutableBuffer

Creates a new buffer of the specified size.

#fromArray Source

fromArray :: Array Octet -> ImmutableBuffer

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

#fromString Source

fromString :: String -> Encoding -> ImmutableBuffer

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

#fromArrayBuffer Source

fromArrayBuffer :: ArrayBuffer -> ImmutableBuffer

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

#read Source

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

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

#readString Source

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

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

#toString Source

toString :: Encoding -> ImmutableBuffer -> String

Reads the buffer as a string with the specified encoding.

#toArray Source

toArray :: ImmutableBuffer -> Array Octet

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

#toArrayBuffer Source

toArrayBuffer :: ImmutableBuffer -> ArrayBuffer

Creates an ArrayBuffer by copying a buffer's contents.

#getAtOffset Source

getAtOffset :: Offset -> ImmutableBuffer -> Maybe Octet

Reads an octet from a buffer at the specified offset.

#concat Source

concat :: Array ImmutableBuffer -> ImmutableBuffer

Concatenates a list of buffers.

#concat' Source

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

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

#slice Source

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

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

#size Source

size :: ImmutableBuffer -> Int

Returns the size of a buffer.