njs/buffer
Buffer is a view of ArrayBuffer
Types
pub type ArrayBuffer
pub type BufferConstants
Valid byte lengths for Buffer readInt/readUInt/writeInt/writeUInt methods.
njs 1.0.0 rejects zero-length reads and writes. Use the _sized helpers
below when the width is known statically.
pub type ByteLength {
One
Two
Three
Four
Five
Six
}
Constructors
-
One -
Two -
Three -
Four -
Five -
Six
pub type TypedArray
pub type TypedArrayType {
Int8
UInt8
Int16
UInt16
Int32
UInt32
}
Constructors
-
Int8 -
UInt8 -
Int16 -
UInt16 -
Int32 -
UInt32
Values
pub fn alloc_unsafe(size s: Int) -> Buffer
pub fn array_buffer_byte_length(ab: ArrayBuffer) -> Int
pub fn byte_length(value v: v, encoding e: Encoding) -> Int
pub fn byte_length_to_int(length: ByteLength) -> Int
pub fn concat(
buffers bs: array.Array(Buffer),
length t: t,
) -> Buffer
pub fn constants() -> BufferConstants
pub fn constants_max_length() -> Int
pub fn constants_max_string_length() -> Int
pub fn from(
array_buffer ab: ArrayBuffer,
offset o: Int,
length l: Int,
) -> Buffer
pub fn from_bytes(array ab: array.Array(BitArray)) -> Buffer
pub fn get_buffer(buffer bf: Buffer) -> ArrayBuffer
pub fn get_buffer_offset(buffer b: Buffer) -> Int
pub fn includes_string(
buffer bf: Buffer,
value v: String,
offset o: Int,
encoding e: Encoding,
) -> Bool
pub fn index_of_string(
buffer bf: Buffer,
value v: String,
offset o: Int,
encoding e: Encoding,
) -> Int
pub fn is_encoding(encoding e: Encoding) -> Bool
pub fn last_index_of_string(
buffer bf: Buffer,
value v: String,
offset o: Int,
encoding e: Encoding,
) -> Int
pub fn new_array_buffer(size s: Int) -> ArrayBuffer
pub fn new_typed_array(
t: TypedArrayType,
size s: Int,
) -> TypedArray
pub fn read_double_be(buffer bf: Buffer, offset o: Int) -> Float
pub fn read_double_le(buffer bf: Buffer, offset o: Int) -> Float
pub fn read_float_be(buffer bf: Buffer, offset o: Int) -> Float
pub fn read_float_le(buffer bf: Buffer, offset o: Int) -> Float
pub fn read_int16_be(buffer bf: Buffer, offset o: Int) -> Int
pub fn read_int16_le(buffer bf: Buffer, offset o: Int) -> Int
pub fn read_int32_be(buffer bf: Buffer, offset o: Int) -> Int
pub fn read_int32_le(buffer bf: Buffer, offset o: Int) -> Int
pub fn read_int_be(
buffer bf: Buffer,
offset o: Int,
byte_length l: Int,
) -> Int
pub fn read_int_be_sized(
buffer bf: Buffer,
offset o: Int,
byte_length l: ByteLength,
) -> Int
pub fn read_int_le(
buffer bf: Buffer,
offset o: Int,
byte_length l: Int,
) -> Int
pub fn read_int_le_sized(
buffer bf: Buffer,
offset o: Int,
byte_length l: ByteLength,
) -> Int
pub fn read_uint16_be(buffer bf: Buffer, offset o: Int) -> Int
pub fn read_uint16_le(buffer bf: Buffer, offset o: Int) -> Int
pub fn read_uint32_be(buffer bf: Buffer, offset o: Int) -> Int
pub fn read_uint32_le(buffer bf: Buffer, offset o: Int) -> Int
pub fn read_uint8(buffer bf: Buffer, offset o: Int) -> Int
pub fn read_uint_be(
buffer bf: Buffer,
offset o: Int,
byte_length l: Int,
) -> Int
pub fn read_uint_be_sized(
buffer bf: Buffer,
offset o: Int,
byte_length l: ByteLength,
) -> Int
pub fn read_uint_le(
buffer bf: Buffer,
offset o: Int,
byte_length l: Int,
) -> Int
pub fn read_uint_le_sized(
buffer bf: Buffer,
offset o: Int,
byte_length l: ByteLength,
) -> Int
pub fn write(
buffer bf: Buffer,
string ba: String,
encoding e: Encoding,
offset o: Int,
length l: Int,
) -> Buffer
write at offset of buffer for length number of bytes
pub fn write_int_be(
buffer bf: Buffer,
value v: Int,
offset o: Int,
byte_length l: Int,
) -> Buffer
pub fn write_int_be_sized(
buffer bf: Buffer,
value v: Int,
offset o: Int,
byte_length l: ByteLength,
) -> Buffer
pub fn write_int_le(
buffer bf: Buffer,
value v: Int,
offset o: Int,
byte_length l: Int,
) -> Buffer
pub fn write_int_le_sized(
buffer bf: Buffer,
value v: Int,
offset o: Int,
byte_length l: ByteLength,
) -> Buffer
pub fn write_uint_be(
buffer bf: Buffer,
value v: Int,
offset o: Int,
byte_length l: Int,
) -> Buffer
pub fn write_uint_be_sized(
buffer bf: Buffer,
value v: Int,
offset o: Int,
byte_length l: ByteLength,
) -> Buffer
pub fn write_uint_le(
buffer bf: Buffer,
value v: Int,
offset o: Int,
byte_length l: Int,
) -> Buffer
pub fn write_uint_le_sized(
buffer bf: Buffer,
value v: Int,
offset o: Int,
byte_length l: ByteLength,
) -> Buffer