addfunction from C to a WASM module.
add.wasmand store it in web native storage. We will list the contents of the directory where the module is stored to confirm it is there. Finally, we will load the module from storage and add some numbers!
webnativeand ask the user for permission to use their web native file system. This example asks for permission to use app storage and uses
fsas an alias for the file system after we initialize.
webnativeand get back a
statethat tells us if the user has authenticated or not.
Continuationcases, the user gave our app permission to use their file system. Otherwise, they have not been asked or they declined.
add.wasmand used it to add numbers on a previous visit, so we check and display a stored result if we have one.
add.wasmand store it in web native storage.
add.wasmand stream the
ArrayBuffer. It will be stored as a
Blobin app storage at the path
blob, write the blob to the local file system, and publish it to the user's wider file system across the web. After we publish, the module is available on any device where the user has set up web native storage.
wasm/mathpath for the directory and call
fs.lsto list its contents. We take each entry in the directory listing and append its metadata to a table.
rhsnumbers, we load
add.wasmand add their numbers.
wasm/math/add.wasmpath, make sure a module exists at that path, and read it into a buffer. We instantiate the WASM module and call the
addfunction off it.
results/add, and now both the module and the last result are available on any device!
fs.rmto delete them. Lastly, we publish the deletion to remove them from the wider file system.