GithubHelp home page GithubHelp logo

isabella232 / workers-wasi Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cloudflare/workers-wasi

0.0 0.0 0.0 763 KB

License: BSD 3-Clause "New" or "Revised" License

Makefile 6.49% TypeScript 42.95% C++ 45.16% JavaScript 3.03% C 1.68% Dockerfile 0.45% Shell 0.25%

workers-wasi's Introduction

Workers WASI

Work in progress

An experimental implementation of the WebAssembly System Interface designed to run on Cloudflare Workers

Usage

import { WASI } from '@cloudflare/workers-wasi';
import mywasm from './mywasm.wasm';

const wasi = new WASI();
const instance = new WebAssembly.Instance(mywasm, {
   wasi_snapshot_preview1: wasi.wasiImport
});

await wasi.start(instance);

Development

Install Rust and nvm then run

nvm use --lts

Build and test

git clone --recursive [email protected]:cloudflare/workers-wasi.git
cd ./workers-wasi
make -j test

Build with Docker

git clone --recursive [email protected]:cloudflare/workers-wasi.git
cd ./workers-wasi
cat ./Dockerfile | docker build -t workers-wasi-build -
docker run --rm -it -v $(pwd):/workers-wasi workers-wasi-build

Testing

We aim to be interchangeable with other WASI implementations. Integration tests are run locally using Miniflare against the following test suites:

Notes

An ephemeral filesystem implementation built on littlefs is included. Both soft and hard links are not yet supported.

The following syscalls are not yet supported and return ENOSYS

  • fd_readdir
  • path_link
  • path_readlink
  • path_symlink
  • poll_oneoff
  • sock_recv
  • sock_send
  • sock_shutdown

Timestamps are captured using Date.now() which has unique behavior on the Workers platform for security reasons. This affects the implementation of

  • clock_res_get
  • clock_time_get
  • fd_filestat_set_times
  • path_filestat_set_times

TODO (remove)

Misc TODO:

  • path_rename (update old path for existing open fds)
  • fix preopens interface (use object), and update options docs
  • document difference between nodejs options and ours (streams/fs)
  • fd_close (stdio)
  • fd_renumber (stdio)
  • fd_read/fd_write does not work with renumbering stdio
  • update file timestamps appropriately

workers-wasi's People

Contributors

kkoenig avatar nilslice avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.