UNPKG

@bytecodealliance/jco

Version:

JavaScript tooling for working with WebAssembly Components

80 lines 3.21 kB
export function setShowSpinner(val: any): void; export function getShowSpinner(): boolean; export function sizeStr(num: any): string; export function fixedDigitDisplay(num: any, maxChars: any): string; /** * Generate tabular output * * @param {string[][]} rows - data to put in rows * @param {string[]} align - alignment of columns * @returns string */ export function table(rows: string[][], align?: string[]): string; /** * Securely creates a temporary directory and returns its path. * * The new directory is created using `fsPromises.mkdtemp()`. * * @returns {Promise<string>} A `Promise` that resovles to a created temporary directory path */ export function getTmpDir(): Promise<string>; /** * Spawn a command that processes a given wasm binary bytes with some * command. * * The command invocations that are generated by this function * take the following form: * * ``` * <cmd> <input wasm file> <...arguments> <output wasm file> * ``` * * @param {string} cmd - the command to run * @param {Buffer<ArrayBufferLike>} inputWasmBytes - bytes that of the input WebAssembly binary * @param {string[]} args - arguments to pass to the command (after the input file and before the output file) * @returns {Promise<Buffer<ArrayBufferLike>>} A `Promise` that resolves when the command has exited */ export function spawnIOTmp(cmd: string, inputWasmBytes: Buffer<ArrayBufferLike>, args: string[]): Promise<Buffer<ArrayBufferLike>>; /** * Given an object that has file names as keys and file contents as values, * write out the files to a their locations. * * This function also prints out the files that were written * * @param {Record<string, string>} files - object which contains files to be written out * @param {boolean} summaryTitle - whether to print the summary after writing out files * @returns {Promise<void>>} A `Promise` that resolves when the fiels are all written * */ export function writeFiles(files: Record<string, string>, summaryTitle: boolean): Promise<void>; /** * Resolve the deafult WIT path, given a possibly * * @param {string | undefined} [witPath] * @returns {Promise<string>} */ export function resolveDefaultWITPath(witPath?: string | undefined): Promise<string>; /** * Partial polyfill for 'node:util' `styleText()` * * @param {string | string[]} styles - styles to apply to the given text * @param {string} text - text that should be styled * @returns {string} The styled string */ export function styleText(styles: string | string[], text: string): string; export const isWindows: boolean; export const ASYNC_WASI_IMPORTS: string[]; export const ASYNC_WASI_EXPORTS: string[]; export const DEFAULT_ASYNC_MODE: "sync"; /** Path of WIT files by default when one is not specified */ export const DEFAULT_WIT_PATH: "./wit"; export { readFileCli as readFile }; /** * Read a given file, throwing a formatted error if one occurs * * @param {string} filePath - path to teh file to read * @param {encoding} encoding - file encoding * @returns {Promise<Buffer>} A promise that resolves to the contents of the file */ declare function readFileCli(filePath: string, encoding: any): Promise<Buffer>; //# sourceMappingURL=common.d.ts.map