API Docs

July 2, 2026 · View on GitHub

Last Updated: v2.4.0 - 07/02/2026

So you're looking to use Terbium APIs. Well, you're in the right place! Terbium has a decent amount of components which I will break down below. The pages will include a description of the functions and code examples.

Table of Contents

Battery

  • showPercentage

    • Description: Shows the battery percentage in the system tray.
    • Returns: Promise<string> - Returns "Success" if successful.
    • Example:
      await tb.battery.showPercentage();
      console.log("Battery percentage is now visible");
      
  • hidePercentage

    • Description: Hides the battery percentage in the system tray.
    • Returns: Promise<string> - Returns "Success" if successful.
    • Example:
      await tb.battery.hidePercentage();
      console.log("Battery percentage is now hidden");
      
  • canUse

    • Description: Checks if the Battery Manager API is available on the current browser.
    • Returns: Promise<boolean> - true if available, false otherwise.
    • Example:
      const canUseBattery = await tb.battery.canUse();
      if (canUseBattery) {
        console.log("Battery API is supported");
      }
      

Launcher

  • addApp

    • Description: Adds an app to the app launcher.
    • Parameters:
      • props: { name: string, icon: string, src: string, etc }
    • Returns: Promise<boolean>
    • Example:
      const wasadded = await tb.launcher.addApp({
        name: "Example App",
        icon: "/home/icon.png",
      });
      console.log(wasadded)
      
  • removeApp

    • Description: Removes an app from the app launcher.
    • Parameters:
      • name: string - The app name to remove.
    • Returns: Promise<boolean>
    • Example:
      const removed = await tb.launcher.removeApp("exampleapp");
      if (removed) {
        console.log("App removed successfully");
      } else {
        console.log("App not found");
      }
      

Theme [⚠ Deprecated]

NOTE: The Theme API is deprecated and remains as a stub for legacy applications

  • get

    • Description: Gets the current theme settings.
    • Returns: Promise<string> - Theme value.
    • Example:
      const themeSettings = await tb.theme.get();
      console.log("Current Theme Settings:", themeSettings);
      
  • set

    • Description: Sets the theme settings.
    • Parameters:
      • data: string - New theme value.
    • Returns: Promise<boolean> - true if successful.
    • Example:
      await tb.theme.set("#ffffff");
      console.log("Theme set successfully");
      

Desktop

  • preferences

    • setTheme

      • Description: Sets the theme color.
      • Parameters:
        • color: string - The new theme color.
      • Example:
        await tb.desktop.preferences.setTheme("#ff0000");
        console.log("Theme color set successfully");
        
    • theme

      • Description: Retrieves the current theme color.
      • Returns: Promise<string> - The current theme color.
      • Example:
      const currentTheme = await tb.desktop.preferences.theme();
      console.log("Current theme color:", currentTheme);
      
    • setAccent

      • Description: Sets the accent color.
      • Parameters:
        • color: string - The new accent color.
      • Example:
        await tb.desktop.preferences.setAccent("#00ff00");
        console.log("Accent color set successfully");
        
    • getAccent

      • Description: Gets the accent color.
      • Example:
        await tb.desktop.preferences.getAccent();
        
  • wallpaper

    • set

      • Description: Sets the wallpaper path.
      • Parameters:
        • path: string - The file path of the wallpaper image.
      • Example:
        await tb.desktop.wallpaper.set("/path/to/wallpaper.jpg");
        console.log("Wallpaper set successfully");
        
    • contain

      • Description: Sets the wallpaper mode to "contain".
      • Example:
        await tb.desktop.wallpaper.contain();
        console.log("Wallpaper mode set to contain");
        
    • stretch

      • Description: Sets the wallpaper mode to "stretch".
      • Example:
        await tb.desktop.wallpaper.stretch();
        console.log("Wallpaper mode set to stretch");
        
    • cover

      • Description: Sets the wallpaper mode to "cover".
      • Example:
        await tb.desktop.wallpaper.cover();
        console.log("Wallpaper mode set to cover");
        
    • fillMode

      • Description: Retrieves the current wallpaper mode.
      • Returns: Promise<string> - The current wallpaper mode.
      • Example:
        const currentMode = await tb.desktop.wallpaper.fillMode();
        console.log("Current wallpaper mode:", currentMode);
        
  • dock

    • pin

      • Description: Pins a new application to the dock.
      • Parameters:
        • app: any - The application to pin.
      • Returns: Promise<string> - Returns 'Success' if the app was pinned successfully.
      • Example:
        await tb.desktop.dock.pin({ title: "MyApp", path: "/path/to/myapp" });
        console.log("Application pinned successfully");
        
    • unpin

      • Description: Unpins an application from the dock.
      • Parameters:
      • app: string - The title of the application to unpin.
      • Returns: Promise<string> - Returns 'Success' if the app was unpinned successfully.
      • Example:
        await tb.desktop.dock.unpin("MyApp");
        console.log("Application unpinned successfully");
        

Window

  • create

    • Description: Creates a new window using window configuration.
    • Parameters:
      • props: any - Window configuration object.
    • Example:
      tb.window.create({
        title: "My Window",
        src: "/fs/apps/system/about.tapp/index.html"
      });
      
  • close

    • Description: closes the active window.
    • Example:
      tb.window.close()
      
  • minimize

    • Description: minimizes the active window.
    • Example:
      tb.window.minimize()
      
  • maximize

    • Description: maximize the active window.
    • Example:
      tb.window.maximize()
      
  • reload

    • Description: refreshes the iframe (if present) in the active window.
    • Example:
      tb.window.reload()
      
  • changeSrc

    • Description: Changes the src of the iframe (if present) in the active window.
    • Example:
      tb.window.changeSrc("/fs/apps/system/about.tapp/index.html")
      
  • getId

    • Description: Gets the ID of the currently active window.
    • Returns: number - Window ID.
    • Example:
      const windowId = tb.window.getId();
      console.log("Current Window ID:", windowId);
      
  • content

    • get
      • Description: Gets the current HTML Content from inside the window
      • Returns: Promise<HTMLDivElement> - The HTML Content inside the window.
      • Example:
      await tb.window.content.get()
      
    • set
      • Description: Sets the current HTML Content from inside the window
      • Example:
      tb.window.content.set(`<div>hi (put any HTML Content here)</div>`)
      
  • titlebar

    • setColor
      • Description: Sets the fore-color of all the window's titlebars
      • Example:
      tb.window.titlebar.setColor('#fff')
      
    • setText
      • Description: Sets the current window's title
      • Example:
      tb.window.titlebar.setText('TB Docs')
      
    • setBackgroundColor
      • Description: Sets the background-color of all the window's titlebars
      • Example:
      tb.window.titlebar.setBackgroundColor('#000')
      
  • island

    • addControl
      • Description: Adds a control to the TB App Island
      • Example:
      tb.window.island.addControl({
        text: "<titleofcontrol>",
        appname: "<appname>",
        id: "<giverandomname>",
        click: () => {
          // Execute code here for when clicked
        }
      })
      
    • removeControl
      • Description: Removes a control from the TB App Island
      • Parameters:
        • control_id: string - The ID used when adding the control.
      • Example:
      tb.window.island.removeControl("<idfromthatyouusedforaddingit>")
      

ContextMenu

  • create

    • Description: Creates a Context Menu at your desired location
    • Parameters:
      • props: { x: number, y: number, options: Array, titlebar?: boolean, iframe?: boolean } - Context menu properties.
    • Example:
      tb.contextmenu.create({
        x: 0,
        y: 0,
        options: [
          { text: "Option 1", click: () => console.log("Option 1 clicked") },
          { text: "Option 2", click: () => console.log("Option 2 clicked") },
        ]
      });
      
  • close

    • Description: Closes the currently open context menu.
    • Example:
      tb.contextmenu.close();
      

User

  • username
    • Description: Fetches the username of the current user.
    • Returns: Promise<string> - User's username.
    • Example:
      const username = await tb.user.username();
      console.log("username:", username);
      
  • pfp
    • Description: Fetches the profile picture of the current user.
    • Returns: Promise<string> - URL/Base64 Encoding of the profile picture.
    • Example:
      const pfp = await tb.user.pfp();
      console.log("PFP:", pfp);
      

Proxy

  • get [⚠ Deprecated]

    • Description: Gets the current proxy settings.
    • Returns: Promise<string> - Proxy settings.
    • Example:
      const proxySettings = await tb.proxy.get();
      console.log("Using:", proxySettings);
      
  • set [⚠ Deprecated]

    • Description: Selects the proxy.
    • Parameters:
      • proxy: string - New proxy settings.
    • Returns: Promise<boolean> - true if successful.
    • Example:
      await tb.proxy.set("Ultraviolet");
      console.log("Proxy set successfully");
      

NOTE: The Proxy switching APIs is deprecated as Ultraviolet has reached End of Life and has been replaced with the latest scramjet version. It remains as a stub for legacy applications and will be removed in the future

  • updateSWs

    • Description: Updates the Transport and Wisp Server of the proxy.
    • Example:
      await tb.proxy.updateSWs();
      console.log("Service Workers updated successfully");
      
  • encode

    • Description: Encodes a URL in the desired format (Only avalible in XOR Currently)
    • Parameters:
      • url: string - The url to encode
      • encoder: string - The encoder (Only avalible in XOR currently)
    • Returns: Promise<string>
    • Example:
      await tb.proxy.encode('https://google.com', 'XOR')
      
  • decode

    • Description: Decodes a URL in the desired format (Only avalible in XOR Currently)
    • Parameters:
      • url: string - The url to decode
      • decoder: string - The decoder (Only avalible in XOR currently)
    • Returns: Promise<string>
    • Example:
      await tb.proxy.decode('https://google.com', 'XOR')
      

Notification

  • Message [🧪Experimental]

    • Description: The notification that has an input field.
    • Parameters:
      • props: { message: string, application: string, iconSrc: string, onOk?: Function, txt?: string, time?: number } - Notification properties.
    • Example:
      tb.notification.Message({ 
        message: "test", 
        application: "System", 
        iconSrc: "/assets/img/logo.png", 
        txt: "fieldtext" 
      });
      
  • Toast

    • Description: A simple notification
    • Parameters:
      • props: { message: string, application: string, iconSrc: string, time?: number } - Notification properties.
    • Example:
      tb.notification.Toast({ 
        message: "test", 
        application: "System", 
        iconSrc: "/assets/img/logo.png", 
        time: 10000 
      });
      
  • Installing

    • Description: An installing/progress style notification. If you pass a task Promise (or async function), the notification stays visible until the task finishes, then it automatically shows a completion toast (or failure toast if it throws).
    • Parameters:
      • props: { message: string, application: string, iconSrc: string, time?: number } - Installing notification properties.
      • task?: Promise<T> | (() => Promise<T>) - Optional async task to track.
      • doneToast?: Partial<NotificationProps> - Optional completion toast overrides.
      • failToast?: Partial<NotificationProps> - Optional failure toast overrides.
    • Returns: Promise<T> | void - Returns the task result when a task is passed.
    • Example:
      await tb.notification.Installing(
        {
          message: "Extracting archive...",
          application: "Files",
          iconSrc: "/assets/img/logo.png"
        },
        async () => await unzip("pathtoalargezipfolder.zip", "/home/user/documents"),
        { message: "Archive extracted successfully" },
        { message: "Archive extraction failed" }
      );
      

Dialog

  • Alert

    • Description: The Alert dialog
    • Parameters:
      • props: { title: string, message: string } - Alert properties.
    • Example:
      tb.dialog.Alert({ title: "Alert", message: "This is an alert message." });
      
  • Message

    • Description: Displays a message dialog with specified properties.
    • Parameters:
      • props: { title: string, defaultValue?: string, onOk?: Function, onCancel?: Function } - Message dialog properties.
    • Example:
      await tb.dialog.Message({
        title: "Example Message",
        defaultValue: "Default value",
        onOk: (value) => console.log("OK clicked with value:", value),
        onCancel: () => console.log("Cancel clicked")
      });
      
  • Select

    • Description: Lets you select a value from a dropdown
    • Parameters:
      • props: { title: string, message?: string, options: Array<{text: string, value: any}>, onOk?: Function, onCancel?: Function } - Select dialog properties.
    • Example:
      await tb.dialog.Select({
        title: "Enter the permission level you wish to set",
        options: [{
          text: "Admin",
          value: "admin"
        }, {
          text: "User",
          value: "user"
        }, {
          text: "Group",
          value: "group"
        }, {
          text: "Public",
          value: "public"
        }],
        onOk: async (perm) => {
          console.log(perm);
        }
      });
      
  • Auth

    • Description: TB Permissions Authentication Dialog
    • Parameters:
      • props: { title: string, defaultUsername?: string, onOk?: Function, onCancel?: Function } - Auth dialog properties.
      • options?: { sudo: boolean } - Additional options to indicate if this is for sudo authentication.
    • Example:
      await tb.dialog.Auth({
        title: "Example Message",
        defaultUsername: "Default value",
        onOk: (user, pass) => console.log("User and unhashed pass", user, pass),
        onCancel: () => console.log("Cancel clicked")
      }, { sudo: false });
      
  • Permissions

    • Description: Yes or No Dialog
    • Parameters:
      • props: { title: string, message: string, onOk?: Function, onCancel?: Function } - Permission dialog properties.
    • Example:
      await tb.dialog.Permissions({
        title: "Example Message",
        message: "Do you want to continue?",
        onOk: () => console.log("OK clicked"),
        onCancel: () => console.log("Cancel clicked")
      });
      
  • FileBrowser

    • Description: Simple FileBrowser Dialog
    • Parameters:
      • props: { title: string, filter?: string, onOk?: Function, onCancel?: Function, local?: boolean } - FileBrowser dialog properties.
    • Example:
      await tb.dialog.FileBrowser({
        title: "Select a file",
        filter: ".txt",
        onOk: (value) => console.log("File selected:", value),
      });
      
  • DirectoryBrowser

    • Description: Simple Directory Browser Dialog
    • Parameters:
      • props: { title: string, defualtDir?: string, onOk?: Function, onCancel?: Function, local?: boolean } - DirectoryBrowser dialog properties.
    • Example:
      await tb.dialog.DirectoryBrowser({
        title: "Select a directory",
        defualtDir: "/home/",
        onOk: (value) => console.log("Selected Dir:", value),
      });
      
  • SaveFile

    • Description: Simple File Saving Dialog
    • Parameters:
      • props: { title: string, defualtDir?: string, filename?: string, onOk?: Function, onCancel?: Function, local?: boolean } - SaveFile dialog properties.
    • Example:
      await tb.dialog.SaveFile({
        title: "Example Title",
        defualtDir: "/home/",
        filename: "tbdocs.md",
        onOk: (value) => console.log("Saved file to:", value)
      });
      
  • Cropper

    • Description: Image Cropper
    • Parameters:
      • props: { title: string, img: string, onOk?: Function } - Cropper dialog properties. Image should be formatted in Base64
    • Returns: Promise<string> - Resolves image when the dialog is closed
    • Example:
      await tb.dialog.Cropper({
        title: "Example Title",
        img: "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",
        onOk: (img) => console.log("new image", img)
      });
      
  • WebAuth

    • Description: Simple Authentication Dialog (for use in Web Authentication)
    • Parameters:
      • props: { title: string, message?: string, defaultUsername?: string, onOk?: Function, onCancel?: Function } - Auth dialog properties.

    NOTE: Because by default the password is not hashed, please encrypt the password if you plan to store it using tb.crypto

    • Example:
      await tb.dialog.WebAuth({
        title: "Example Message",
        defaultUsername: "Default value",
        onOk: (user, pass) => console.log("User and unhashed pass", user, pass),
        onCancel: () => console.log("Cancel clicked")
      });
      

Node

  • webContainer

    • Description: The current webContainer instance for the Node Subsystem. Refer to WebContainers API for documentation.
    • Returns: WebContainer instance
  • servers

    • Description: A Map of ports running on the Node Subsystem
    • Returns: Map<number, string> - Map of port numbers to server URLs
  • isReady

    • Description: Returns whether or not the WebContainer is booted.
    • Returns: boolean - true if ready, false otherwise
  • start

    • Description: Boots the WebContainer
    • Example:
      tb.node.start();
      console.log("WebContainer started");
      
  • stop

    • Description: Stops the WebContainer
    • Returns: boolean - true if stopped successfully
    • Example:
      try {
        const stopped = tb.node.stop();
        console.log("WebContainer stopped");
      } catch (err) {
        console.error("No WebContainer is running");
      }
      

Platform

  • getPlatform
    • Description: Gets the current platform the user is using
    • Returns: Promise<string> - Platform ("mobile" or "desktop")
    • Example:
      const platform = await tb.platform.getPlatform();
      console.log(`You're on: ${platform}`);
      

Process

  • kill

    • Description: Kill a process. The argument may be a PID (number or numeric string) or any object that resolves to a process when compared by PID.
    • Parameters:
      • config: string | number | any - The PID of the process to terminate (or an object containing a pid property).
    • Example:
      // simple kill by PID
      tb.process.kill(69420);
      
      // you can also look up a process then kill it
      const procs = tb.process.list();
      const first = Object.values(procs)[0];
      tb.process.kill(first.pid);
      
  • list

    • Description: Return the current process table.
    • Returns: Record<number, ProcInf> - a map of PID to process information (see ProcessInfo type in types.ts for fields such as name, pid, parent, children, status, memory, cpu, etc.)
    • Example:
      const processes = tb.process.list();
      console.log(processes);
      
  • procs

    • Description: Public property exposing the live process record. It is equivalent to calling tb.process.list() but can be modified directly when spawning new entries.
    • Example:
      console.log(tb.process.procs); // same as tb.process.list()
      
  • create

    • Description: Creates a new process entry. This is primarily used by the runtime when spawning windows or background tasks, but you can call it manually for testing.
    • Parameters:
      • type: "window" | "runtime" – the kind of process to create.
      • config: any – configuration object describing the process (window size, title, etc.).
    • Example:
      tb.process.create("runtime", { name: "my-task" });
      
  • parse

    • build [🧪Experimental]
      • Description: Building Process of Custom TML Formatted Apps
      • Parameters:
        • src: string - Source string to build
      • Returns: void
      • Example:
        tb.process.parse.build("<tml>...</tml>");
        

Screen

  • captureScreen
    • Description: Creates a screenshot of your screen and saves it
    • Returns: Promise<void>

    NOTE: The screen capture API is used with the alt+shift keybind. Be aware of that to prevent any conflictions with your application if you use a similar keybind.

    • Example:
      await tb.screen.captureScreen();
      

VFS

  • servers

    • Description: A Map of the current users webdav servers
    • Returns: Object - VFSOperations
    • Example:
    for (const instance of tb.vfs.servers) {
      const davInfo = instance[1];
      // Use dav instance info here including a already established connection if one is availible
    }
    
  • currentServer

    • Description: The current WebDav server to use for operations
    • Returns: Object - VFSOperations
    • Example:
    const client = tb.vfs.currentServer.connection.client;
    // use webdav methods here or use VFS Operations as a drop in for working between TFS and VFS
    
  • create

    • Description: (async) Returns a new instance of VFS, You will probably not use this function unless your directly modifying terbiums codebase
    • Returns: Promise<VFS>
    • Example:
    const vfs = await vfs.create();
    
  • mount

    • Description: Mounts the inputed server from vfs.servers
    • Parameters:
      • serverName: string - the name of the server to mount
    • Example:
    await tb.vfs.mount("servername");
    
  • mountAll

    • Description: Mounts all servers avalible in vfs.servers
    • Example:
    await tb.vfs.mountAll()
    
  • addServer

    • Description: Adds a server to the users WebDav server list
    • Parameters:
      • Server: ServerInfo[] - The server information to put in
    • Example:
    await tb.vfs.addServer({
      name: "any name you want for the drive name";
      url: "https://somedavendpoint.com/";
      username: "IloveTerbiumDev";
      password: "XSTARSwasHere";
    })
    
  • removeServer

    • Description: Removes a server from the users WebDav server list
    • Parameters:
      • ServerName: string - The name of the server to remove
    • Example:
    await tb.vfs.removeServer("webdav1")
    
  • setServer

    • Description: Sets currentServer to the requested server
    • Parameters:
      • ServerName: string - The server name to set the server too NOTE Server MUST be mounted to perform this operation.
    • Example:
    await tb.vfs.setServer("webdav1");
    // tb.vfs.currentServer is now the instance of VFSOperations that webdav1 uses
    
  • whatFS

    • Description: Returns Either TFS or VFSOperations as the suitable File System for you to use for said drive
    • Parameters:
      • Path: string - The path to check
    • Example:
    const fs = await tb.vfs.whatFS("/mnt/dav");
    // FS is VFSOperations
    const fs = await tb.vfs.whatFS("/home/XSTARS/");
    // FS is TFS.fs
    
  • VFSOperations

    NOTE: This is NOT an API. This is an instance representing File System actions, WebDav client information, etc., and is referenced by several APIs above.

    Properties

    • client: WebDavClient
      The WebDav Client Interface.

    Methods

    • readdir(path, callback)

      • Reads the contents of a directory at the given path.
      • Parameters:
        • path: string — Directory path.
        • callback: (err: any, files?: any[]) => void — Called with error or array of file names.
    • readFile(path, callback)

      • Reads the contents of a file as text.
      • Parameters:
        • path: string — File path.
        • callback: (err: any, data?: string) => void — Called with error or file data.
    • writeFile(path, data, callback)

      • Writes data to a file, replacing its contents.
      • Parameters:
        • path: string — File path.
        • data: string | ArrayBuffer — Data to write.
        • callback: (err: any) => void — Called with error if any.
    • delete(path, callback)

      • Deletes a file at the specified path.
      • Parameters:
        • path: string — File path.
        • callback: (err: any) => void — Called with error if any.
    • rename(oldPath, newPath, callback)

      • Renames or moves a file from oldPath to newPath.
      • Parameters:
        • oldPath: string — Original file path.
        • newPath: string — New file path.
        • callback: (err: any) => void — Called with error if any.
    • createDirectory(path, callback)

      • Creates a new directory at the specified path.
      • Parameters:
        • path: string — Directory path.
        • callback: (err: any) => void — Called with error if any.
    • exists(path, callback)

      • Checks if a file or directory exists at the given path.
      • Parameters:
        • path: string — Path to check.
        • callback: (err: any, exists?: boolean) => void — Called with error or existence boolean.
    • stat(path, callback)

      • Retrieves metadata/statistics about a file or directory.
      • Parameters:
        • path: string — Path to check.
        • callback: (err: any, stat?: any) => void — Called with error or stat object.
    • copy(source, destination, callback)

      • Copies a file from source to destination.
      • Parameters:
        • source: string — Source file path.
        • destination: string — Destination file path.
        • callback: (err: any) => void — Called with error if any.
    • unlink(path, callback)

      • Deletes a file at the specified path (alias for delete).
      • Parameters:
        • path: string — File path.
        • callback: (err: any) => void — Called with error if any.
    • move(source, destination, callback)

      • Moves a file from source to destination (alias for rename).
      • Parameters:
        • source: string — Source file path.
        • destination: string — Destination file path.
        • callback: (err: any) => void — Called with error if any.
    • appendFile(path, data, callback)

      • Appends data to the end of a file.
      • Parameters:
        • path: string — File path.
        • data: string | ArrayBuffer — Data to append.
        • callback: (err: any) => void — Called with error if any.

    All of these functions also have a Promises variant that has the exact same syntax except it does not have a callback instead you use it asynchronously

System

  • version

    • Description: Lists the version of Terbium
    • Returns: string - Terbium version.
    • Example:
      const terbiumVersion = tb.system.version();
      console.log("Terbium v:", terbiumVersion);
      
  • instance

    • repo

      • Description: Lists the repository information
      • Returns: string - Repository information.
      • Example:
        const repo = tb.system.instance.repo;
        console.log("The repo is: " + repo);
        
    • hash

      • Description: Lists the git commit hash
      • Returns: string - Git hash.
      • Example:
        const hash = tb.system.instance.hash;
        console.log("The git hash is: " + hash);
        
  • openApp

    • Description: Opens an installed application
    • Parameters:
      • pkg: string - Package ID of the app.
      • options?: Partial<WindowConfig> - Any other window configuration options you want to provide
    • Example:
      await tb.system.openApp("browser");
      await tb.system.openApp("settings", { message: { type: "process", path: "wallpaper" }})
      
  • download

    • Description: Download a file from the internet to the File System
    • Parameters:
      • url: string - URL of the file to download.
      • location: string - Destination path in the file system.
    • Returns: Promise<void>
    • Example:
      await tb.system.download('https://example.com/example.txt', '/home/exampledownload.txt');
      
  • exportfs

    • Description: Exports the file system as a zip file
    • Parameters:
      • startPath?: string - Starting path (default: "/")
      • filename?: string - Output filename (default: "tbfs.backup.zip")
    • Returns: Promise<string> - URL of the created zip file
    • Example:
      await tb.system.exportfs("/home/", "backup.zip");
      
  • scanintegrity

    • Description: Scans the integrity of the file system and returns an array of courupted paths
    • Returns: Array - Array of the courupted file paths
    • Example:
      await tb.system.scanintegrity()
      
  • users

    • list

      • Description: Lists all users in the system
      • Returns: Promise<string[]> - Array of usernames
      • Example:
        const users = await tb.system.users.list();
        console.log(users);
        
    • add

      • Description: Adds a user to the system
      • Parameters:
        • user: { username: string, password: string, pfp: string, perm: string, securityQuestion?: { question: string, answer: string } } - User information
      • Returns: Promise<boolean> - true if successful
      • Example:
        await tb.system.users.add({ 
          username: 'XSTARS', 
          password: 'terbium1234', 
          pfp: 'data:image/png;base64,...', 
          perm: 'Admin' 
        });
        
    • remove

      • Description: Removes a user from the system
      • Parameters:
        • id: string - Username to remove
      • Returns: Promise<boolean> - true if successful
      • Example:
        await tb.system.users.remove('XSTARS');
        
    • update

      • Description: Updates the data on a user
      • Parameters:
        • user: { username: string, password?: string, pfp?: string, perm?: string, securityQuestion?: object } - User information to update
      • Returns: Promise<void>
      • Example:
        await tb.system.users.update({ 
          username: 'XSTARS', 
          password: 'iloveterbium', 
          pfp: 'data:image/png;base64,...', 
          perm: 'Public' 
        });
        
    • renameUser

      • Description: Renames a user in the system
      • Parameters:
        • olduser: string - Current username
        • newuser: string - New username
      • Returns: Promise<void>
      • Example:
        await tb.system.users.renameUser('oldname', 'newname');
        
  • startup

    • addProc

      • Description: Adds a new process to the startup list. This will register a package or command to run on system or user startup.
      • Parameters:
        • pkgorname: string - The package name or unique identifier for the startup entry.
        • target: "System" | "User" - Whether the startup entry is registered system-wide or for the current user.
        • cmd?: string - Optional command to execute for the entry (if different from the package default).
      • Returns: Promise<void>
      • Example:
        await tb.system.startup.addProc('my-service', 'System', 'alert("alert evaled")');
        
    • removeProc

      • Description: Removes a previously registered startup process.
      • Parameters:
        • pkgorname: string - The package name or identifier of the entry to remove.
        • target: "System" | "User" - The scope from which to remove the entry.
      • Returns: Promise<void>
      • Example:
        await tb.system.startup.removeProc('my-service', 'System');
        
    • enable

      • Description: Enables a registered startup process so it will run at boot for the specified scope.
      • Parameters:
        • pkgorname: string - The package name or identifier of the entry to enable.
        • target: "System" | "User" - The scope in which to enable the entry.
      • Returns: Promise<void>
      • Example:
        await tb.system.startup.enable('my-service', 'User');
        
    • disable

      • Description: Disables a registered startup process so it will not run at boot.
      • Parameters:
        • pkgorname: string - The package name or identifier of the entry to disable.
        • target: "System" | "User" - The scope in which to disable the entry.
      • Returns: Promise<void>
      • Example:
        await tb.system.startup.disable('my-service', 'User');
        
    • list

      • Description: Lists all configured startup entries.
      • Returns: Promise<object[]> - An array of startup entries (each entry contains details such as name, target, command, enabled state).
      • Example:
        const procs = await tb.system.startup.list();
        console.log(procs);
        
  • bootmenu

    • addEntry

      • Description: Adds a boot entry into the Terbium Boot Menu
      • Parameters:
        • name: string - The name to display in the boot menu
        • file: string - The file to boot from (file path)
      • Returns: Promise<void>
      • Example:
        await tb.system.bootmenu.addEntry('Legacy TB', '/legacy-tb/index.html');
        
    • removeEntry

      • Description: Removes a boot entry from the Terbium Boot Menu
      • Parameters:
        • name: string - The name of the entry to remove
      • Returns: Promise<void>
      • Example:
        await tb.system.bootmenu.removeEntry('Legacy TB');
        

Terbium Cloud (tauth)

  • client

    • Description: The authentication client instance for Terbium Cloud services
    • Returns: AuthClient - Authentication client object
  • signIn

    • Description: Sign in to Terbium Cloud Account
    • Returns: Promise<any> - Sign-in response with user data
    • Example:
      try {
        const result = await tb.tauth.signIn();
        console.log("Signed in:", result.data.user);
      } catch (err) {
        console.error("Sign-in cancelled or failed:", err);
      }
      
  • signOut

    • Description: Sign out from Terbium Cloud Account
    • Returns: Promise<void>
    • Example:
      await tb.tauth.signOut();
      console.log("Signed out successfully");
      
  • isTACC

    • Description: Checks if the current user (or specified user) is a Terbium Cloud Account
    • Parameters:
      • username?: string - Username to check (defaults to current user)
    • Returns: Promise<boolean> - true if user has TACC, false otherwise
    • Example:
      const hasTACC = await tb.tauth.isTACC();
      if (hasTACC) {
        console.log("User has a Terbium Cloud Account");
      }
      
  • updateInfo

    • Description: Updates Terbium Cloud Account information
    • Parameters:
      • user: Partial<User> - User information to update (can include username, pfp, email, password, etc.)
    • Returns: Promise<void>
    • Example:
      await tb.tauth.updateInfo({ 
        username: "newusername", 
        pfp: "data:image/png;base64,..." 
      });
      
  • reauth

    • Description: Logs back into Terbium Cloud
    • Returns: Promise<void>
    • Example:
      await tb.tauth.reauth();
      
  • getInfo

    • Description: Gets Terbium Cloud Account information
    • Parameters:
      • username?: string - Username to get info for (defaults to current user)
    • Returns: Promise<User | null> - User account information or null if not found
    • Example:
      const info = await tb.tauth.getInfo();
      if (info) {
        console.log("Account info:", info);
      }
      
  • sync

    • retreive

      • Description: Retrieves synced data from Terbium Cloud (settings, WebDAV servers, etc.)
      • Returns: Promise<void>
      • Example:
        await tb.tauth.sync.retreive();
        console.log("Settings synced from cloud");
        
    • upload

      • Description: Uploads local settings and data to Terbium Cloud
      • Returns: Promise<void>
      • Example:
        await tb.tauth.sync.upload();
        console.log("Settings uploaded to cloud");
        
    • isSyncing

      • Description: Indicates whether a sync operation is currently in progress
      • Returns: boolean - true if syncing, false otherwise
      • Example:
        if (tb.tauth.sync.isSyncing) {
          console.log("Sync in progress...");
        }
        

Mediaplayer

NOTE: Make sure that the endtime for the music and video island is formatted in seconds and not milliseconds or minutes, that applies to the time parameter (start time) as well.

  • music

    • Description: Activates the Music optimized Media Island
    • Parameters:
      • props: { artist: string, track_name: string, album?: string, time?: number, background: string, endtime: number, onSeek?: void, onPausePlay: void, onNext?: void; onBack?: void } - Music player properties.
    • Example:
      tb.mediaplayer.music({
        track_name: "Starboy",
        artist: "The Weeknd",
        endtime: 231,
        background: "https://is1-ssl.mzstatic.com/image/thumb/Music126/v4/02/17/ce/0217ce34-c2b9-3d3d-1dec-586db3948753/23UMGIM22526.rgb.jpg/1200x1200bf-60.jpg"
      });
      
  • video

    • Description: Activates the Video optimized Media Island
    • Parameters:
      • props: { creator: string, video_name: string, time?: number, background: string, endtime: number, onSeek?: void, onPausePlay: void, onNext?: void; onBack?: void } - Video player properties.
    • Example:
      tb.mediaplayer.video({
        video_name: "The school smp one year later...",
        creator: "Playingallday383",
        endtime: 1273,
        background: "https://i.ytimg.com/vi/kiKmSq4gxNU/hqdefault.jpg"
      });
      
  • hide

    • Description: Hides the media island.
    • Example:
      tb.mediaplayer.hide();
      
  • pauseplay

    • Description: Pauses or plays the content connected to the media island
    • Example:
      tb.mediaplayer.pauseplay();
      
  • isExisting

    • Description: Tells you if the media island is already present or not.
    • Returns: Promise<boolean> - true if media island exists, false otherwise
    • Example:
      const exists = await tb.mediaplayer.isExisting();
      if (exists) {
        console.log('A media island is already there');
      }
      

File

  • handler

    • openFile

      • Description: Opens a file with the associated app based on file type.
      • Parameters:
        • path: string - Path of the file.
        • type: string - Type of the file (e.g., "text", "image", "video", "audio", "pdf", "webpage").
      • Returns: Promise<void>
      • Example:
        await tb.file.handler.openFile("/home/example.txt", "text");
        
    • addHandler

      • Description: Adds a handler for a specific file extension
      • Parameters:
        • app: string - App name to handle the file type
        • ext: string - File extension
      • Returns: Promise<boolean> - Returns true if succeeded
      • Example:
        await tb.file.handler.addHandler("ruffle", "swf");
        
    • removeHandler

      • Description: Removes a handler for a specific file extension
      • Parameters:
        • ext: string - File extension
      • Returns: Promise<boolean> - Returns true if succeeded
      • Example:
        await tb.file.handler.removeHandler("swf");
        
  • icons

    • get

      • Description: Gets icon path for a file extension.
      • Parameters:
        • ext: string - File extension.
      • Returns: Promise<string> - Icon path.
      • Example:
        const icon = await tb.file.icons.get("png");
        console.log(icon);
        
    • set

      • Description: Sets icon path for a file extension.
      • Parameters:
        • ext: string - File extension.
        • iconPath: string - Path to icon.
      • Returns: Promise<boolean>
      • Example:
        await tb.file.icons.set("log", "/assets/img/file-log.png");
        
    • remove

      • Description: Removes custom icon mapping for a file extension.
      • Parameters:
        • ext: string - File extension.
      • Returns: Promise<boolean>
      • Example:
        await tb.file.icons.remove("log");
        

Additional Libraries

  • libcurl
    • Description: The libcurl networking API, used in Anura.net, TB Apps and tb.system.download
  • fflate
    • Description: ZIP compression/decompression tool for Anura File Manager and TB Files App
  • fs
    • Description: File system API (TFS) for reading/writing files
  • crypto
    • Description: Password encryption tool
    • Parameters:
      • pass: string - Password to encrypt
      • file?: string - (optional) File to save the password to
    • Returns: Promise<string> - Encrypted password or "Complete" if saved to file
  • vfs
    • Description: Virtual File System for WebDAV servers and remote storage
  • buffer
    • Description: Buffer utility (from Filer) for working with binary data
  • registry
    • Description: System registry for storing and retrieving system-wide configuration
  • sh
    • Description: Shell interface for file system operations
  • liquor (Anura)
    • Description: Anura subsystem stub, provides compatibility with Anura applications
  • lemonade (Electron)
    • Description: Electron API compatibility layer for desktop-like features

Have fun developing for Terbium!