googlechromelabs / wasi-fs-access Goto Github PK
View Code? Open in Web Editor NEWThis is a demo shell powered by WebAssembly, WASI, Asyncify and File System Access API.
Home Page: https://wasi.rreverser.com/
License: Apache License 2.0
This is a demo shell powered by WebAssembly, WASI, Asyncify and File System Access API.
Home Page: https://wasi.rreverser.com/
License: Apache License 2.0
I want build this project.
And i getting this error
src/browser.ts:307:20 - error TS2571: Object is of type 'unknown'.
307 term.writeln(err.message);
~~~
src/fileSystem.ts:171:15 - error TS2571: Object is of type 'unknown'.
171 if (err.name === 'TypeMismatchError') {
~~~
src/fileSystem.ts:184:13 - error TS2571: Object is of type 'unknown'.
184 if (err.name === 'TypeMismatchError') {
~~~
src/test.ts:134:25 - error TS2571: Object is of type 'unknown'.
134 message = err.message;
~~~
Found 4 errors.
Howe can i resolve this error ?
Hi.
I took a docker container from emscripten.
Launched the container.
Made a server for this project.
Gave access to the directory of its file system.
How can I use find this open directory from my filesystem? I want to build an application using the docker environment.
docker pull emscripten/emsdk:2.0.25
docker run -it -d -p 80:80 -p 7319:7319 --name wasm --volume ~/wasm:/src emscripten/emsdk:2.0.25
docker exec -it wasm bash
git clone https://github.com/ZababurinSergei/wasi-fs-access
cd wasi-fs-access
npm install && npm run start
I get console there i get my file system
But how get my file system in docker ?
/sandbox$ mount /mount/point
Successfully mounted (...host path...)/opt at /mount/point.
/sandbox$ df -a
Filesystem 1k-blocks Used Available Use% Mounted on
wasi 0 0 0 - /sandbox
wasi 0 0 0 - /mount/point
/sandbox$ cd /mount/point
/mount/point$ ls
ls: error: '.': No such file or directory
Exit code: 1
The working directory error message points to a solved upstream issue https://github.com/WebAssembly/WASI/issues/303
I liked the idea of the project. So I compiled may program for wasi.
cargo wasi build --release
./wasm-opt --asyncify -O3 rdm4-bin.wasi.wasm -o rdm4.wasm
The problem is my program runs for about 120s (Windows 450ms and Linux 50 ms). On https://webassembly.sh/ it takes about 4s.
The problematic code was serde_json::to_writer_pretty
(109KB output file). Using BufWriter
made it comparable to the webassembly.sh runtime at least when using navigator.storage.getDirectory()
. Writing to a real folder each new file write_all
call takes additional ~1s.
So I tested on wasi.rreverser.com:
dd if=/dev/urandom of=sample.data bs=1M count=10
mount /tmp
mount /dst
On Windows Chrome the cp
command can not copy files larger than 3MB (Chromium on Linux works fine, but is super slow for an m.2 ssd ~2MB/s
cat can copy a 20MB file even on Windows (cat /tmp/sample.data > /dst/sample.test34
)
Errors on Windows include:
There is a similar project webassembly.sh. This project has great file system support and That project has couple of packages from WAPI (python, grep, jq, ...) Maybe contribute this project features to that or pull WAPI from that project is a good idea?
When i can get build i get this error
src/browser.ts:28:31 - error TS2339: Property 'getSystemDirectory' does not exist on type '{ new (): FileSystemDirectoryHandle; prototype: FileSystemDirectoryHandle; }'.
28 FileSystemDirectoryHandle.getSystemDirectory({
~~~~~~~~~~~~~~~~~~
src/browser.ts:46:36 - error TS2552: Cannot find name 'FileSystemHandleKind'. Did you mean 'FileSystemHandleUnion'?
46 get(this: FileSystemHandle): FileSystemHandleKind {
~~~~~~~~~~~~~~~~~~~~
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.