Skip to main content
Version: v1.0.0-beta.0

compile()

compile(
fileManager,
projectPath?,
logFn?,
debugLogFn?): Promise<ProgramCompilationArtifacts>

Compiles a Noir project

Parameters

ParameterTypeDescription
fileManagerFileManagerThe file manager to use
projectPath?stringThe path to the project inside the file manager. Defaults to the root of the file manager
logFn?LogFnA logging function. If not provided, console.log will be used
debugLogFn?LogFnA debug logging function. If not provided, logFn will be used

Returns

Promise<ProgramCompilationArtifacts>

Example

// Node.js

import { compile_program, createFileManager } from '@noir-lang/noir_wasm';

const fm = createFileManager(myProjectPath);
const myCompiledCode = await compile_program(fm);
// Browser

import { compile_program, createFileManager } from '@noir-lang/noir_wasm';

const fm = createFileManager('/');
for (const path of files) {
await fm.writeFile(path, await getFileAsStream(path));
}
const myCompiledCode = await compile_program(fm);

Generated using typedoc-plugin-markdown and TypeDoc