Module

Node.Buffer.ST

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

#STBuffer Source

data STBuffer :: Region -> Typedata STBuffer t0

A reference to a mutable Buffer for use with ST

The type parameter represents the memory region which the (STBuffer h) belongs to.

Instances

#run Source

run :: (forall h. ST h (STBuffer h)) -> ImmutableBuffer

Runs an ST creating an STBuffer then freezes the (STBuffer h) and returns it, without unneccessary copying.

#create Source

create :: forall h. Int -> ST h (STBuffer h)

Creates a new STBuffer. Alias of alloc.

#alloc Source

alloc :: forall h. Int -> ST h (STBuffer h)

Creates a new STBuffer.

#allocUnsafe Source

allocUnsafe :: forall h. Int -> ST h (STBuffer h)

Creates a new STBuffer of the specified size. Unsafe because it reuses memory from a pool and may contain sensitive data. See the Node docs: https://nodejs.org/docs/latest-v18.x/api/buffer.html#what-makes-bufferallocunsafe-and-bufferallocunsafeslow-unsafe

#allocUnsafeSlow Source

allocUnsafeSlow :: forall h. Int -> ST h (STBuffer h)

Creates a new STBuffer of the specified size. Unsafe because it reuses memory from a pool and may contain sensitive data. See the Node docs: https://nodejs.org/docs/latest-v18.x/api/buffer.html#what-makes-bufferallocunsafe-and-bufferallocunsafeslow-unsafe

#compareParts Source

compareParts :: forall h. STBuffer h -> STBuffer h -> Int -> Int -> Int -> Int -> ST h Ordering

#freeze Source

freeze :: forall h. (STBuffer h) -> ST h ImmutableBuffer

#unsafeFreeze Source

#thaw Source

thaw :: forall h. ImmutableBuffer -> ST h (STBuffer h)

#unsafeThaw Source

unsafeThaw :: forall h. ImmutableBuffer -> ST h (STBuffer h)

#fromArray Source

fromArray :: forall h. Array Octet -> ST h (STBuffer h)

#fromString Source

fromString :: forall h. String -> Encoding -> ST h (STBuffer h)

#fromArrayBuffer Source

fromArrayBuffer :: forall h. ArrayBuffer -> ST h (STBuffer h)

#toArrayBuffer Source

toArrayBuffer :: forall h. STBuffer h -> ST h ArrayBuffer

#read Source

read :: forall h. BufferValueType -> Offset -> STBuffer h -> ST h Number

#readString Source

readString :: forall h. Encoding -> Offset -> Offset -> STBuffer h -> ST h String

#toString Source

toString :: forall h. Encoding -> STBuffer h -> ST h String

#toString' Source

toString' :: forall h. Encoding -> Offset -> Offset -> STBuffer h -> ST h String

#write Source

write :: forall h. BufferValueType -> Number -> Offset -> STBuffer h -> ST h Unit

#writeString Source

writeString :: forall h. Encoding -> Offset -> Int -> String -> STBuffer h -> ST h Int

#toArray Source

toArray :: forall h. STBuffer h -> ST h (Array Octet)

#getAtOffset Source

getAtOffset :: forall h. Offset -> STBuffer h -> ST h (Maybe Octet)

#setAtOffset Source

setAtOffset :: forall h. Octet -> Offset -> STBuffer h -> ST h Unit

#slice Source

slice :: forall h. Offset -> Offset -> STBuffer h -> STBuffer h

#size Source

size :: forall h. STBuffer h -> ST h Int

#concat Source

concat :: forall h. Array (STBuffer h) -> ST h (STBuffer h)

#concat' Source

concat' :: forall h. Array (STBuffer h) -> Int -> ST h (STBuffer h)

#copy Source

copy :: forall h. Offset -> Offset -> STBuffer h -> Offset -> STBuffer h -> ST h Int

#fill Source

fill :: forall h. Octet -> Offset -> Offset -> STBuffer h -> ST h Unit

#swap16 Source

swap16 :: forall h. STBuffer h -> ST h (STBuffer h)

#swap32 Source

swap32 :: forall h. STBuffer h -> ST h (STBuffer h)

#swap64 Source

swap64 :: forall h. STBuffer h -> ST h (STBuffer h)

#transcode Source

transcode :: forall h. STBuffer h -> Encoding -> Encoding -> ST h (STBuffer h)