0.1.1 • Published 3 years ago

buffer-as v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

AS AS-Buffer

Buffer implementation for AssemblyScript

Installation

~ npm install buffer-as

Usage

import { Buffer } from 'buffer-as'

const buf = Buffer.from('Hello World!')

console.log(buf.toString('utf8'))
// 'Hello World!'

API

Buffer.from(data: T, encoding: string | null) Create a new buffer from multiple data types.

Buffer.write(str: string): Buffer Write string data to the buffer.

Buffer.slice(start: i32, end: i32): Buffer Slices the buffer into a chunk.

Buffer.alloc(size: i32): Buffer Allocate an empty buffer with a defined size.

Buffer.allocUnsafe(size: i32): Buffer Allocate an empty buffer with a defined size. Unsafe.

Buffer.allocUnsafeSlow(size: i32): Buffer Allocate an empty buffer with a defined size. Unsafe.

Buffer.isBuffer(obj: T): boolean Check if a object is of type buffer.

Buffer.toString(encoding: string | null): string Convert a buffer to a string.

Buffer.toJSON(): JSONbuffer Convert a buffer to a JSON object.

Buffer.equals(otherBuffer: Buffer): boolean Check if this buffer equals another buffer.

Buffer.isEncoding(encoding: string): boolean Check if the provided encoding is valid.

Buffer.concat(list: Buffer[]): Buffer Join a list of buffers into a single buffer.

Buffer.byteLength(string: string, encoding?: string): i32 Get the byte length of a string.

0.1.0

3 years ago

0.1.1

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago