MCPcopy Create free account
hub / github.com/WebAssembly/wabt / toText

Method toText

src/wabt.post.js:296–324  ·  view source on GitHub ↗
(options = {})

Source from the content-addressed store, hash-verified

294 }
295
296 toText(options = {}) {
297 const foldExprs = options.foldExprs ?? false;
298 const inlineExport = options.inlineExport ?? false;
299
300 const writeModuleResult_addr = Module._wabt_write_text_module(
301 this.module_addr, foldExprs, inlineExport);
302
303 const result =
304 Module._wabt_write_module_result_get_result(writeModuleResult_addr);
305
306 let outputBuffer;
307 try {
308 if (result !== WABT_OK) {
309 throw new Error('toText failed.');
310 }
311
312 outputBuffer = new OutputBuffer(
313 Module._wabt_write_module_result_release_output_buffer(
314 writeModuleResult_addr));
315
316 return outputBuffer.toString();
317
318 } finally {
319 if (outputBuffer) {
320 outputBuffer.destroy();
321 }
322 Module._wabt_destroy_write_module_result(writeModuleResult_addr);
323 }
324 }
325
326 toBinary(options = {}) {
327 const log = options.log ?? false;

Callers

nothing calls this directly

Calls 2

toStringMethod · 0.45
destroyMethod · 0.45

Tested by

no test coverage detected