Security News
Highlights from the 2024 Rails Community Survey
A record 2,709 developers participated in the 2024 Ruby on Rails Community Survey, revealing key tools, practices, and trends shaping the Rails ecosystem.
WebAssembly and SharedArrayBuffer IO. Pronounced "wassabee-yo".
wasabio
offers several utility APIs with familiar interfaces, and implemented
to work over a single SharedArrayBuffer and inside a TS-wrapped WASM module.
wasabio
provides infrastructure for multi threaded applications running in web
browsers, enabling safe cross-worker communication and shared state.
wasabio
can be used in bundlers like Webpack to allow for an exchange between
node core modules and its own implementations to seamlessly run in the browser.
Currently wasabio
provides:
All APIs are spec-compatible with their original counterparts.
note: library needs to be initialized before use, see below.
import {
localStorage, // in-memory key-value store for cross worker state storage
EventEmitter, // lets you make named emitter for cross worker communication
readFile,
writeFile,
appendFile,
readFileSync,
writeFileSync,
appendFileSync,
// ... Node FS api
} from "wasabio";
Some utility functions are also provided:
// return true if library is initialized
available(): boolean;
// serializes memory to a buffer, sets the thread counter to 0
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>
Initialize wasabio
on the first thread (usually the main thread) like so:
// main.ts
import { initialize } from "wasabio";
const mem = await initialize();
// some time later
worker.postMessage(mem);
On other threads (workers, frames, etc.) initialize wasabio
like so:
// worker.ts
import { initialize } from "wasabio";
addEventListener("message", async ({ data }) => {
initialize(data, { sync: true }); // sync as an option
});
Initialize wasabio
on the first thread (usually the main thread) like so:
// main.ts
import { initialize } from "wasabio";
const cold = getSharedArrayBufferFromSomewhere();
const hot = await initialize(cold, { reboot: true });
// some time later
worker.postMessage(hot);
On other threads (workers, frames, etc.) initialize wasabio
like so:
// worker.ts
import { initialize } from "wasabio";
addEventListener("message", async ({ data }) => {
initialize(data, { reboot: false });
});
In this case, reboot
signifies that the library is being initialized from cold
storage and thread-local state should be reset.
FAQs
WebAssembly and SharedArrayBuffer IO. Pronounced 'wassabee-yo'.
The npm package wasabio receives a total of 0 weekly downloads. As such, wasabio popularity was classified as not popular.
We found that wasabio demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A record 2,709 developers participated in the 2024 Ruby on Rails Community Survey, revealing key tools, practices, and trends shaping the Rails ecosystem.
Security News
In 2023, data breaches surged 78% from zero-day and supply chain attacks, but developers are still buried under alerts that are unable to prevent these threats.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.