Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

assemblyscript-loader

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

assemblyscript-loader

AssemblyScript's loader component as a stand-alone module.

  • 0.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
39
increased by290%
Maintainers
1
Weekly downloads
 
Created
Source

AssemblyScript Loader

AssemblyScript's loader component to run and work with compiled WebAssembly modules, as a stand-alone module.

Usage

$> npm install assemblyscript-loader
import load from "assemblyscript-loader";

load("path/to/module.wasm", {
  imports: {
    ...
  }
}).then(module => {
  ...
  // i.e. call module.exports.main()
});

API

  • load(file: ArrayBuffer | Uint8Array | string, options: ILoadOptions): Promise<IModule>
    Loads a WebAssembly module either from a buffer or from a file and returns a promise for an IModule.

  • ILoadOptions
    Options to set up the environment created by load.

    • initialMemory: number
      Initial size of the memory in 64kb pages.
    • maximumMemory: number
      Maximum size of the memory in 64kb pages.
    • imports: { [key: string]: any }
      Import elements. Usually functions.
  • IModule
    Common module interface as returned by load.

    • memory: WebAssembly.Memory
      A reference to the underlying memory instance.
    • imports: { [key: string]: any }
      Imported elements. Usually functions.
    • exports: { [key: string]: any }
      Exported elements. Usually functions.
    • S8: Int8Array
      An 8-bit signed integer view on the memory.
    • U8: Uint8Array
      An 8-bit unsigned integer view on the memory.
    • S16: Int16Array
      A 16-bit signed integer view on the memory.
    • U16: Uint16Array
      A 16-bit unsigned integer view on the memory.
    • S32: Int32Array
      A 32-bit signed integer view on the memory.
    • U32: Uint32Array
      A 32-bit unsigned integer view on the memory.
    • F32: Float32Array
      A 32-bit float view on the memory.
    • F64: Float64Array
      A 64-bit float view on the memory.
    • currentMemory(): number
      Gets the current size of the memory in 64kb pages.
    • growMemory(numPages: number): number
      Grows the memory by the specified number of 64kb pages.

Note that memory views (I8, U8, etc.) are updated when the module's memory grows, hence make sure to always access them directly on the module instance.

Keywords

FAQs

Package last updated on 23 Jun 2017

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc