Skip to content

Latest commit

 

History

History

cli

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Frontend for Node.js

Usage

For an up to date list of available command line options, see:

$> asc --help 

API

The API accepts the same options as the CLI but also lets you override stdout and stderr. Example:

importascfrom"assemblyscript/asc";const{ error, stdout }=awaitasc.main(["myModule.ts","--outFile","myModule.wasm","--optimize","--sourceMap","--stats"]);if(error){console.log("Compilation failed: "+error.message);}else{console.log(stdout.toString());}

The result has the following structure:

PropertyDescription
errorEncountered error, if any
stdoutStandard output stream
stderrStandard error stream
statsStatistics

You can also compile a single source string directly (note that this API has limited functionality):

importascfrom"assemblyscript/asc";const{ binary, text, stdout, stderr }=awaitasc.compileString(`...`,{optimize: 2}); ...

Available command line options can also be obtained programmatically:

import{options}from"assemblyscript/asc"; ...
close