- WebAssembly - Discussion
- WebAssembly - Useful Resources
- WebAssembly - Quick Guide
- WebAssembly - Examples
- WebAssembly - Working with Nodejs
- WebAssembly - Working with Go
- WebAssembly - Working with Rust
- WebAssembly - Working with C++
- WebAssembly - Working with C
- WebAssembly - Security
- WebAssembly - Dynamic Linking
- WebAssembly - Convert WAT to WASM
- WebAssembly - Text Format
- WebAssembly - Validation
- WebAssembly - Modules
- WebAssembly - “Hello World”
- WebAssembly - Debugging WASM in Firefox
- WebAssembly - Javascript API
- WebAssembly - Javascript
- WebAssembly - Program Structure
- WebAssembly - Tools to Compile to WASM
- WebAssembly - Installation
- WebAssembly - WASM
- WebAssembly - Introduction
- WebAssembly - Overview
- WebAssembly - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
WebAssembly - Vapdation
In this chapter, we are going to discuss the webassembly.vapdate() function that will vapdate the .wasm output. The .wasm is available when we compile C, C++ or rust code.
You can make use of the following tools to get the wasm code.
Wasm Fiddler,which is available at
WebAssembly Explorer, which is available at
Syntax
The syntax is as given below −
WebAssembly.vapdate(bufferSource);
Parameters
bufferSource − The bufferSource has the binary code that comes from either C, C++ or Rust program. It is in the form of typedarray or ArrayBuffer.
Return Value
The function will return true if the .wasm code is vapd and false if not.
Let us try one example. Go to
, which is available at enter C code of your choice and down the wasm code.The block marked in red is the C code. Cpck on the Build button at the center to execute the code.
Cpck on the Wasm , button to download the .wasm code. Save the .wasm at your end and let us use the same for vapdating.
Example
For Example: vapdate.html
<!doctype html> <html> <head> <meta charset="utf-8"> <title>Testing WASM vapdate()</title> </head> <body> <script> fetch( program.wasm ).then(res => res.arrayBuffer() ).then(function(testbytes) { var vapd = WebAssembly.vapdate(testbytes); if (vapd) { console.log("Vapd Wasm Bytes!"); } else { console.log("Invapd Wasm Code!"); } }); </script> </body> </html>
I have hosted the above .html file in wamp server along with the download .wasm file. Here, is the output when you test it in the browser.
Output
The output is the mentioned below −
Advertisements