Package io.ktor.utils.io.js

Functions

Link copied to clipboard
inline fun MessageEvent.packet(): ByteReadPacket
Link copied to clipboard
fun ByteReadPacket.readArrayBuffer(n: Int = remaining.coerceAtMostMaxIntOrFail("Unable to make a new ArrayBuffer: packet is too big")): ArrayBuffer

Read exactly n bytes to a new array buffer instance

Link copied to clipboard
fun ByteReadPacket.readText(encoding: String, max: Int = Int.MAX_VALUE): String
fun ByteReadPacket.readText(encoding: String = "UTF-8", out: Appendable, max: Int = Int.MAX_VALUE): Int
Link copied to clipboard
fun XMLHttpRequest.responsePacket(): ByteReadPacket
Link copied to clipboard
fun WebSocket.sendPacket(packet: ByteReadPacket)
inline fun WebSocket.sendPacket(block: BytePacketBuilder.() -> Unit)
fun XMLHttpRequest.sendPacket(packet: ByteReadPacket)
inline fun XMLHttpRequest.sendPacket(block: BytePacketBuilder.() -> Unit)
Link copied to clipboard
fun BytePacketBuilder.writeFully(src: ArrayBuffer, offset: Int = 0, length: Int = src.byteLength - offset)

Write exactly length bytes from the specified src array buffer

fun BytePacketBuilder.writeFully(src: Int8Array, offset: Int = 0, length: Int = src.length - offset)

Write exactly length bytes from the specified src typed array