javy

0.1.2 • Public • Published

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.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.2
    2,223
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.1.2
    2,223
  • 0.1.1
    4,458
  • 0.1.0
    210
  • 0.0.3
    231
  • 0.0.2
    0
  • 0.0.1
    0

Package Sidebar

Install

npm i javy

Weekly Downloads

7,122

Version

0.1.2

License

Apache-2.0

Unpacked Size

13.4 kB

Total Files

18

Last publish

Collaborators

  • saulecabrera
  • surma
  • jeffcharles-shopify