Skip to content

Documentation / @andrew_l/tl-pack / BinaryWriter

Class: BinaryWriter

Constructors

Constructor

new BinaryWriter(__namedParameters): BinaryWriter

Parameters

__namedParameters

BinaryWriterOptions = {}

Returns

BinaryWriter

Properties

offset

offset: number

Accessors

safeEnd

Get Signature

get safeEnd(): number

Returns

number

Methods

allocate()

allocate(size): this

Parameters

size

number

Returns

this


encode()

encode(value): Uint8Array

Parameters

value

any

Returns

Uint8Array


endDynamicVector()

endDynamicVector(): this

Returns

this


getBuffer()

getBuffer(): Uint8Array

Returns

Uint8Array


reset()

reset(): this

Reset internal state

Returns

this


startDynamicVector()

startDynamicVector(): this

Returns

this


wireDictionary()

wireDictionary(value): this

Parameters

value

string

Returns

this


writeBool()

writeBool(value): this

Parameters

value

boolean

Returns

this


writeByte()

writeByte(value): this

Parameters

value

number

Returns

this


writeBytes()

writeBytes(value): this

Parameters

value

Uint8Array

Returns

this


writeChecksum()

writeChecksum(withConstructor): this

Parameters

withConstructor

boolean = true

Returns

this


writeDate()

writeDate(value): this

Parameters

value

number | Date

Returns

this


writeDouble()

writeDouble(value): this

Parameters

value

number

Returns

this


writeFloat()

writeFloat(value): this

Parameters

value

number

Returns

this


writeGzip()

writeGzip(value): this

Parameters

value

ArrayBuffer | Uint8Array

Returns

this


writeInt16()

writeInt16(value, signed): this

Parameters

value

number

signed

boolean = true

Returns

this


writeInt32()

writeInt32(value, signed): this

Parameters

value

number

signed

boolean = true

Returns

this


writeInt8()

writeInt8(value, signed): this

Parameters

value

number

signed

boolean = true

Returns

this


writeLength()

writeLength(value): this

Parameters

value

number

Returns

this


writeMap()

writeMap(object): this

Parameters

object

Record<string, any>

Returns

this


writeNull()

writeNull(): this

Returns

this


writeObject()

writeObject(value): this

Parameters

value

any

Returns

this


writeObjectGzip()

writeObjectGzip(value): this

Parameters

value

any

Returns

this


writeString()

writeString(value): this

Parameters

value

string

Returns

this


writeStructure()

writeStructure(value): this

Parameters

value

Structure

Returns

this


writeVector()

writeVector(value): this

Parameters

value

any[]

Returns

this