satish
satish

Reputation: 943

Is it possible to take a WASM file and go back to a JS file?

Although I suspect the answer is no, I'll ask anyway. Given a Web Assembly file (.wasm), is it possible to de-compile that file into a Javascript file?

Upvotes: 0

Views: 881

Answers (2)

ColinE
ColinE

Reputation: 70132

No, you cannot.

JavaScript doesn’t compile to WebAssembly, although you can use the experimental AssemblyScript compiler to compile Typescript (which is a JavaScript superset) to WebAssembly.

This point aside, decompilation to the original source is not possible. Much of the information is lost in the process of compiling to WebAssembly.

However, this might become possible in the future. The sourcemaps technology allows you to map between code in different formats. It is typically used for mapping transpiled and minifed JavaScript back to its source. This technology could potentially be used for WebAssembly. This is not decompilation, rather, it is a mapping.

Upvotes: 1

Bergi
Bergi

Reputation: 664434

No. (Web) assembly is not compiled from JS in the first place, that's the whole point.

Upvotes: 1

Related Questions