Writer

@perion/net. Writer

Writes packets in little endian format

Constructor

new Writer(length)

Source:
Parameters:
Name Type Default Description
length number 32

The length of the packet in bytes

Methods

ascii(str) → {Writer}

Source:

Writes an ASCII string

Parameters:
Name Type Description
str string

A string

Returns:

A reference to the current Writer

Type
Writer

bool(bool) → {Writer}

Source:

Writes a boolean value

Parameters:
Name Type Description
bool boolean

A boolean

Returns:

A reference to the current Writer

Type
Writer

buffer() → {Buffer}

Source:

Returns the packet Buffer

Returns:

The output Buffer

Type
Buffer

byte(byte) → {Writer}

Source:

Writes a byte

Parameters:
Name Type Description
byte number

The byte to write

Returns:

A reference to the current Writer

Type
Writer

dynamicAlloc(byteSize)

Source:

Used to allocated more bytes to the Buffer dynamically

Parameters:
Name Type Description
byteSize number

Total byte length required

int(int) → {Writer}

Source:

Writes an integer

Parameters:
Name Type Description
int number

An integer

Returns:

A reference to the current Writer

Type
Writer

long(long) → {Writer}

Source:

Writes a long

Parameters:
Name Type Description
long bigint

A long

Returns:

A reference to the current Writer

Type
Writer

mapleascii(str) → {Writer}

Source:

Writes a MapleStory ASCII string

Parameters:
Name Type Description
str string

A string

Returns:

A reference to the current Writer

Type
Writer

nullascii(str) → {Writer}

Source:

Writes a null-terminated ASCII string

Parameters:
Name Type Description
str string

A string

Returns:

A reference to the current Writer

Type
Writer

pos(pos) → {Writer}

Source:

Writes a position

Parameters:
Name Type Description
pos Point

A position {x, y}

Returns:

A reference to the current Writer

Type
Writer

short(short) → {Writer}

Source:

Writes a short

Parameters:
Name Type Description
short number

A short

Returns:

A reference to the current Writer

Type
Writer

ubyte(uByte) → {Writer}

Source:

Writes an unsigned byte

Parameters:
Name Type Description
uByte number

An unsigned byte

Returns:

A reference to the current Writer

Type
Writer

uint(uInt) → {Writer}

Source:

Writes an unsigned integer

Parameters:
Name Type Description
uInt number

An unsigned integer

Returns:

A reference to the current Writer

Type
Writer

ulong(uLong) → {Writer}

Source:

Writes an unsigned long

Parameters:
Name Type Description
uLong bigint

An unsigned long

Returns:

A reference to the current Writer

Type
Writer

ushort(uShort) → {Writer}

Source:

Writes an unsigned short

Parameters:
Name Type Description
uShort number

An unsigned short

Returns:

A reference to the current Writer

Type
Writer

write(buf) → {Writer}

Source:

Writes a Buffer

Parameters:
Name Type Description
buf Buffer

A buffer

Returns:

A reference to the current Writer

Type
Writer