JSPM

@hazae41/memory

1.0.10
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 30
  • Score
    100M100P100Q58913F
  • License MIT

Disposable bytes for TypeScript & WebAssembly

Package Exports

  • @hazae41/memory

Readme

Memory

Disposable bytes for TypeScript & WebAssembly

npm i @hazae41/memory

Node Package 📦

Features

  • 100% TypeScript and ESM
  • Rust-like patterns

Usage

import { Memory, Slice } from "@hazae41/memory"

function f(memory: Memory) {
  // Consume memory
  using _  = memory

  // Use raw bytes
  g(memory.bytes)
}

function g(bytes: Uint8Array) {
  console.log(bytes)
}

// Use with JavaScript bytes
f(new Slice(new Uint8Array([1,2,3])))

// Use with WebAssembly bytes
f(MyModule.somethingThatReturnsBytes())