0.1.2 • Published 10 months ago

javy v0.1.2

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
10 months ago

Javy Lib

This library provides abstractions and convenience methods over Javy's built-in functions.

In javy/fs:

readFileSync(fd)

Returns a Uint8Array representation (a byte array) of the contents of a file descriptor.

writeFileSync(fd, buffer)

Writes the contents of a Uint8Array to a file descriptor.

STDIO

Has Stdin, Stdout, and Stderr properties which correspond to the integer file descriptors for standard input, standard output, and standard error for use with readFileSync and writeFileSync.

Usage example

import { readFileSync, writeFileSync, STDIO } from `javy/fs`

const textEncoder = new TextEncoder();

const inputBuffer = readFileSync(STDIO.Stdin);
const inputText = new TextDecoder().decode(inputBuffer);

const stdoutContent = `${inputText} -- out`;
const stderrContent = `${inputText} -- err`;

writeFileSync(STDIO.Stdout, textEncoder.encode(stdoutContent));
writeFileSync(STDIO.Stderr, textEncoder.encode(stderrContent));

Tests

To run the tests, run npm test. It requires you to have a release build of javy and have wasmtime installed.

Publishing

Run npm run build before running npm publish.

0.1.2

10 months ago

0.1.1

1 year ago

0.1.0

1 year ago

0.0.3

1 year ago

0.0.2

2 years ago

0.0.1

2 years ago