Skip to main content
Module

x/easyts/mod.ts>Bytes

js library written with ts, use select and chan like golang in js.
class Bytes
implements Iterable<number>
extends ClassForEach<number>
import { Bytes } from "https://deno.land/x/easyts@0.1.0/mod.ts";

Constructors

new
private
Bytes(
buffer: ArrayBuffer,
start: number,
end: number,
)

Properties

readonly
capacity: number

return bytes capacity

readonly
length: number

return bytes length

readonly
reverse: Iterable<number>

Returns an object that implements a js Iterable, but it traverses the data in reverse

Methods

private
_append(b: bytesLike): Bytes
append(...vals: Array<number>): Bytes

Add a new element at the end of the slice and return the new slice

appendArrayBuffer(...vals: Array<ArrayBuffer>): Bytes
appendBytes(...vals: Array<Bytes>): Bytes
appendString(str: string): Bytes
copy(src: Bytes): number

return DataView of Bytes

iterator(reverse?: boolean): Iterator<number>

return js iterator

slice(start?: number, end?: number): Bytes

take sub-slices

toString(): string
[Symbol.iterator](): Iterator<number>

implements js Iterable

Static Methods

attach(
b: ArrayBuffer,
start?: number,
end?: number,
): Bytes

Creates a Bytes attached to the incoming ArrayBuffer

fromString(str: string): Bytes

Create a Bytes from string

make(length: number, capacity?: number): Bytes

Create a Bytes