Skip to content

Latest commit

 

History

History
208 lines (117 loc) · 6.27 KB

API.md

File metadata and controls

208 lines (117 loc) · 6.27 KB

API documentation

Note

The long term goal for LLRT is to become Winter CG compliant. Not every API from Node.js will be supported.

buffer

alloc

from

concat

byteLength

Everything else inherited from Uint8Array

child_process

Warning

spawn uses native streams that is not 100% compatible with the Node.js Streams API.

spawn

crypto

createHash

createHmac

randomBytes

randomFill

randomFillSync

randomUUID

events

EventEmitter

fetch

Available globally

fetch

Important

There are some differences with the WHATWG standard. Mainly browser specific behavior is removed:

  • keepalive is always true
  • body can only be string, Array, ArrayBuffer or Uint8Array
  • mode, credentials, referrerPolicy, priority, cache is not available/applicable

fs/promises

readdir

readFile

writeFile

mkdir

mkdtemp

rmdir

rm

stat

access

constants

hex

export function encode(value:string|Array|ArrayBuffer|Uint8Array):string
export function decode(value:string):Uint8Array

module

createRequire

Note

require is available from esm modules natively. This function is just for compatibility

os

platform

tmpdir

release

type

path

dirname

basename

extname

format

parse

join

resolve

normalize

isAbsolute

delimiter

timers

Also available globally

setImmediate

setInterval

setTimeout

clearImmediate

clearInterval

clearTimeout

util

Important

Supported encodings: hex, base64, utf8, iso88591. Supported methods: encode & decode

TextEncoder

TextDecoder

uuid

export const NIL:string

export function v1():string

export function v3(name:string, namespace:Array|Uint8Array|String):string

export function v4():string

export function v5(name:string, namespace:Array|Uint8Array|String):string

export function parse(value:string):Uint8Array

export function stringify(arr:Array|Uint8Array):string

export function validate(arr:string):boolean

export function version(arr:Array|Uint8Array):number

xml

A lightweight and fast XML parser

type XmlParserOptions = {
    ignoreAttributes?: boolean;
    attributeNamePrefix?: string;
    textNodeName?: string;
    attributeValueProcessor?: (attrName: string, attrValue: string, jpath: string) => unknown;
    tagValueProcessor?: (attrName: string, attrValue: string, jpath: string, hasAttributes: boolean) => unknown;
}
export class XMLParser(options?: XmlParserOptions){
    parse(xml:string):object
}

net

Warning

These APIs uses native streams that is not 100% compatible with the Node.js Streams API. Server APIs like createSever provides limited functionality useful for testing purposes. Serverless applications typically don't expose servers. Some server options are not supported: highWaterMark, pauseOnConnect, keepAlive, noDelay, keepAliveInitialDelay

createConnection

connect

createServer

Misc Global objects

structuredClone

atoa

atob