Options
All
  • Public
  • Public/Protected
  • All
Menu

Module bitburner/lib/exec

A library for executing Bitburner scripts on remote hosts, without needing to worry about whether or not the script is present on the remote host.

Index

Functions

Functions

exec

  • exec(ns: NS, script: string, targetHost: string, threads: number, args: (string | number | boolean)[]): Promise<number>
  • A wrapper function for ns.exec which uses ns.scp to ensure the script is present and up-to-date on the target host.

    Parameters

    • ns: NS

      A Netscript context.

    • script: string

      The script to be executed.

    • targetHost: string

      The host the script is to be executed on.

    • threads: number

      The number of threads with which the script is to be executed.

    • args: (string | number | boolean)[]

      The arguments with which the script is to be executed.

    Returns Promise<number>

    • The PID of the newly-executed script if successful.
    • 0 if ns.exec failed somehow.
    • -1 if the script doesn't exist.
    • -2 if the target host doesn't exist.
    • -3 if the thread count is too low.
    • -4 if there isn't enough ram on the target host.
    • -5 if the thread count is a non-integer.
    • -6 if the script is already running.
    • -7 if ns.scp fails for some reason.

Generated using TypeDoc