Skip to content

Utilities and bundled libraries

Besides its own bridges, Sys exposes a helper for pausing (Sys.wait) and several libraries as-is, for example Sys.Ramda or Sys.HttpClient. For third-party libraries, Lowgile adds nothing: use the upstream documentation of the version listed.

Availability: Everywhere

wait(timeMs: number): Promise<void>

Returns a promise that resolves after the given time, so that await Sys.wait(…) pauses the current code without blocking other work.

ParameterTypeDescription
timeMsnumberTime to wait, in milliseconds.
await Sys.wait(2000) // continue after 2 seconds

Returns: Promise<void> · Availability: Everywhere

getHttpClient(): Promise<import("axios").AxiosStatic>

Loads the axios HTTP client (package axios, version ^1.12.1) in the browser and returns it. Lowgile loads axios only on the first call, so it is not part of the app’s initial download. On the server, use Sys.HttpClient.

Upstream documentation: axios

const http = await Sys.getHttpClient()
const { data } = await http.get('https://api.example.com/rates', { params: { base: 'CHF' } })

Returns: Promise<AxiosStatic> · Availability: Client

const Ramda: typeof CommonSys.Ramda

The functional utility library Ramda (package ramda, version ^0.29.1): functions for lists, objects and function composition that do not change their inputs.

Upstream documentation: Ramda

const ordersByStatus = Sys.Ramda.groupBy((order) => order.status, orders)

Type: typeof import('ramda') · Availability: Everywhere

import { default as HttpClient } from 'axios'

The HTTP client axios (package axios, version ^1.12.1), for calling REST APIs and other HTTP endpoints from server-side code.

Upstream documentation: axios

const { data } = await Sys.HttpClient.get('https://api.example.com/rates', { params: { base: 'CHF' } })

Type: AxiosStatic · Availability: Server

import * as https from 'https'

Node’s built-in https module (Node.js 24 or later), for HTTPS requests and agents at a lower level than Sys.HttpClient, for example an agent with client certificates or keep-alive.

Upstream documentation: Node https

const httpsAgent = new Sys.Https.Agent({ keepAlive: true })
const response = await Sys.HttpClient.get('https://api.example.com/rates', { httpsAgent })

Type: typeof import('https') · Availability: Server

import path from 'node:path'

Node’s built-in path module (Node.js 24 or later), for building, splitting and normalizing file paths on the server’s platform. Sys.Fs.Path offers a subset of it.

Upstream documentation: Node path

const csvName = Sys.Path.basename(filePath, '.csv')

Type: typeof import('path') · Availability: Server

import * as Xml from 'xml-js'

The XML converter xml-js (package xml-js, version ^1.6.11), which converts XML text to JavaScript objects or JSON and back.

Upstream documentation: xml-js

const document = Sys.Xml.xml2js(xmlText, { compact: true })
const xml = Sys.Xml.js2xml(document, { compact: true, spaces: 2 })

Type: typeof import('xml-js') · Availability: Server

import QrCode from 'qrcode'

The QR code generator node-qrcode (package qrcode, version ^1.5.1), which renders text as a QR code image: as a data URL, a Buffer, an SVG string or a file.

Upstream documentation: node-qrcode

const pngDataUrl = await Sys.QrCode.toDataURL('https://example.com/orders/42')

Type: typeof import('qrcode') · Availability: Server

import Confetti from 'canvas-confetti'

The confetti animation canvas-confetti (package canvas-confetti, version ^1.9.4), which shoots confetti over the page in the browser, for example to celebrate a completed task.

Upstream documentation: canvas-confetti

Sys.Confetti({ particleCount: 150, spread: 70 })

Type: typeof import('canvas-confetti') · Availability: Client

export * as RustLib from '@lg/rust-lib'

Lowgile’s own native library (package @lg/rust-lib, crate version 0.1.0), compiled from Rust with napi-rs. It currently contains sample and benchmark functions rather than business functionality.

Type: typeof import('@lg/rust-lib') · Availability: Server

syncFoo(): string

Returns the text 'Hello, world!', computed in native code.

Returns: string · Availability: Server

asyncFoo(): Promise<string>

Returns the text 'Hello, world!' asynchronously, computed in native code.

Returns: Promise<string> · Availability: Server

factorial(n: number): bigint

Returns n!, the product of all whole numbers from 1 to n, as a bigint. For n of 0 the result is 1n.

ParameterTypeDescription
nnumberNon-negative whole number. Results are correct up to n = 33.

Returns: bigint · Availability: Server

Note

The native code computes with 128-bit integers. For n greater than 33 the result overflows and is wrong, without an error.

mandelbrotSum(width: number, height: number, maxIter: number): Promise<number>

Computes the Mandelbrot set on a grid of width × height points covering real parts from −2.5 to 1 and imaginary parts from −1.25 to 1.25, and returns the total number of iterations over all points. Each point iterates until it escapes (absolute value above 2) or reaches maxIter. The computation runs outside the JavaScript thread, so it is useful as a benchmark for native code.

ParameterTypeDescription
widthnumberNumber of grid points along the real axis.
heightnumberNumber of grid points along the imaginary axis.
maxIternumberMaximum number of iterations per point.

Returns: Promise<number> · Availability: Server