Skip to content

Commit

Permalink
feat: webpack plugin and (de)compression api
Browse files Browse the repository at this point in the history
  • Loading branch information
3p3r committed Mar 30, 2024
1 parent d0e41c9 commit 9a4105e
Show file tree
Hide file tree
Showing 7 changed files with 1,041 additions and 262 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

WebAssembly and SharedArrayBuffer IO. Pronounced "wassabee-yo".

- [Purpose](#purpose)
- [Usage](#usage)
- [API](#api)
- [Initialization](#initialization)
- [From New Memory](#from-new-memory)
- [From Existing Memory](#from-existing-memory)
- [Webpack Plugin](#webpack-plugin)

## Purpose

`wasabio` offers several utility APIs with familiar interfaces, and implemented
Expand Down Expand Up @@ -51,6 +59,10 @@ available(): boolean;
serialize(memory: WebAssembly.Memory): Uint8Array;
// deserializes buffer to memory, sets the correct buffer size
deserialize(buffer: Uint8Array): WebAssembly.Memory;
// compresses serialized wasabio memory buffer into a zip buffer
compress(buffer: Uint8Array): Promise<Uint8Array>
// decompresses zip buffer into serialized wasabio memory buffer
decompress(buffer: Uint8Array): Promise<Uint8Array>
```

### Initialization
Expand Down Expand Up @@ -102,3 +114,12 @@ addEventListener("message", async ({ data }) => {

In this case, `reboot` signifies that the library is being initialized from cold
storage and thread-local state should be reset.

### Webpack Plugin

A Webpack plugin is provided to allow for seamless integration of `wasabio` into
any project. The plugin currently supports generating a WASM memory that can be
used to boot the library on the main thread with.

If you are not interested in using the Webpack plugin, you may opt out of its
dependencies being installed by using `npm install wasabio --omit=optional`.
Loading

0 comments on commit 9a4105e

Please sign in to comment.