Package Exports
- @hazae41/memory
Readme
Memory
Disposable bytes for TypeScript & WebAssembly
npm i @hazae41/memoryFeatures
- 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())