Socket
Book a DemoInstallSign in
Socket

buffer-as

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

buffer-as

NodeJS Buffer for AssemblyScript

latest
Source
npmnpm
Version
0.1.1
Version published
Maintainers
1
Created
Source

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.

Keywords

AssemblyScript

FAQs

Package last updated on 09 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts