WebAssembly port of FreeBSD coreutils providing 54 Unix command-line utilities for browser and server environments
npx @tessl/cli install tessl/npm-cowasm--coreutils@1.1.0@cowasm/coreutils provides WebAssembly ports of 54 essential FreeBSD Unix command-line utilities, enabling traditional Unix tools to run in browser and server JavaScript environments. This package compiles C source code to WebAssembly, offering cross-platform compatibility for file system operations, text processing, and system utilities within the CoWasm ecosystem.
npm install @cowasm/coreutilsconst { path } = require("@cowasm/coreutils");For ES modules:
import { path } from "@cowasm/coreutils";const { path } = require("@cowasm/coreutils");
const { join } = require("path");
// Get the path to WebAssembly binaries
const wasmBinPath = path; // Points to dist/wasm directory
const lsBinary = join(wasmBinPath, "bin", "ls");
// Use with a WebAssembly runtime (e.g., @cowasm/posix-wasm)
// The exact execution method depends on your WebAssembly runtime@cowasm/coreutils is built around these key components:
The package exports a single path property pointing to the WebAssembly binaries directory.
/**
* Path to the WebAssembly binaries directory
*/
exports.path: string;Essential file system operations including listing, copying, moving, and permission management.
// Available WebAssembly binaries in dist/wasm/bin/:
// ls, cat, cp, mv, rm, rmdir, mkdir, chmod, ln, touch, statComprehensive text processing utilities for filtering, searching, formatting, and transforming text data.
// Available WebAssembly binaries in dist/wasm/bin/:
// grep, head, tail, cut, sort, uniq, wc, tr, fmt, fold, expand, unexpand, nl, paste, join, comm, csplitSystem information and environment utilities for inspecting and managing system state.
// Available WebAssembly binaries in dist/wasm/bin/:
// uname, id, logname, env, date, tty, du, whichPath manipulation and resolution utilities for working with file and directory paths.
// Available WebAssembly binaries in dist/wasm/bin/:
// basename, dirname, readlink, realpath, pathchkMathematical operations and logical testing utilities.
// Available WebAssembly binaries in dist/wasm/bin/:
// expr, factor, seq, test, falseAdditional utility programs for various specialized tasks.
// Available WebAssembly binaries in dist/wasm/bin/:
// sleep, mktemp, xargs, yes, pr, tee, find, tsortinterface CoreutilsExports {
/** Path to the WebAssembly binaries directory (dist/wasm) */
path: string;
}Some utilities have known issues in the WebAssembly environment:
Building from source requires:
npm run build or make -j8 all