Data.ByteString
- Package
- purescript-bytestrings
- Repository
- rightfold/purescript-bytestrings
#ByteString Source
#unsafeFreeze Source
unsafeFreeze :: Buffer -> ByteString
O(1) The result points directly into the buffer. Mutating the buffer afterwards results in undefined behavior.
#unsafeThaw Source
unsafeThaw :: ByteString -> Buffer
O(1) The result points directly into the byte string. Mutating the buffer results in undefined behavior.
#empty Source
empty :: ByteString
O(1) The empty byte string.
#singleton Source
singleton :: Octet -> ByteString
O(1) A byte string with a single byte.
#unsafeIndex Source
unsafeIndex :: ByteString -> Int -> Octet
O(1) Get the nth byte. If the index is out of bounds, the behavior is undefined.
#cons Source
cons :: Octet -> ByteString -> ByteString
Θ(n) Prepend a byte.
#snoc Source
snoc :: ByteString -> Octet -> ByteString
Θ(n) Append a byte.
#uncons Source
uncons :: ByteString -> Maybe { head :: Octet, tail :: ByteString }
Θ(n) Unprepend a byte.
#unsnoc Source
unsnoc :: ByteString -> Maybe { init :: ByteString, last :: Octet }
Θ(n) Unappend a byte.
#tail Source
tail :: ByteString -> Maybe ByteString
Θ(n) Get all but the first byte.
#init Source
init :: ByteString -> Maybe ByteString
Θ(n) Get all but the last byte.
#length Source
length :: ByteString -> Int
O(1) How many bytes are in this byte string?
#isEmpty Source
isEmpty :: ByteString -> Boolean
O(1) Check if a byte string is empty.
#map Source
map :: (Octet -> Octet) -> ByteString -> ByteString
Θ(n) Transform the bytes in the byte string.
#reverse Source
reverse :: ByteString -> ByteString
Θ(n) Reverse the byte string.
#foldableOfOctet Source
foldableOfOctet :: forall a. Foldable a -> a ~ Octet
O(1) Witness that foldable byte strings can only contain octets.
#foldl Source
foldl :: forall a. (a -> Octet -> a) -> a -> ByteString -> a
Θ(n) Fold a byte string.
#foldr Source
foldr :: forall a. (Octet -> a -> a) -> a -> ByteString -> a
Θ(n) Fold a byte string.
#fromString Source
fromString :: String -> Encoding -> Maybe ByteString
Θ(n) Encode a string.
#toUTF8 Source
toUTF8 :: String -> ByteString
Θ(n) unsafePartial fromJust <<< flip fromString UTF8
.
#fromUTF8 Source
fromUTF8 :: ByteString -> String
Θ(n) flip toString UTF8
Re-exports from Node.Encoding
#Encoding
data Encoding
Constructors
ASCII
UTF8
UTF16LE
UCS2
Base64
Latin1
Binary
Hex
Instances
Show Encoding