Interface GetArgv

Hierarchy

  • GetArgv

Properties

ARG_MAX: number

Constant

Description

the maximum number of bytes that can be passed as args to a process (including env vars, etc)

PID_MAX: number

Constant

Description

the maximum value a pid may have on the system

Methods

  • Gets the arguments of a process as an array of strings

    Returns

    An array of strings representing the arguments of pid.

    Throws

    TypeError if called with: missing pid, missing encoding argument, too many arguments, invalid number as pid, or if options.fatal is true and it encounters malformed data while decoding.

    Throws

    RangeError if called with: invalid encoding argument, pid outside valid range: 0..PID_MAX inclusive.

    Throws

    SystemError if the underlying sysctl or parsing fails.

    Parameters

    • pid: number

      The pid of the process whose arguments you want, must be between 0..PID_MAX inclusive.

    • encoding: TextEncoding

      The encoding to attempt to apply to the arguments. Must be an enumerated value of TextEncoding.

    • Optional options: {
          fatal?: boolean;
          ignoreBOM?: boolean;
      }

      The options to use when decoding the process' arguments' bytes into strings.

      • Optional fatal?: boolean
      • Optional ignoreBOM?: boolean

    Returns string[]

  • Gets the arguments of a process as a string

    Returns

    A string representing the arguments of pid, formatted as requested.

    Throws

    TypeError if called with: missing pid, missing encoding argument, invalid number as pid, invalid number as skip, or if options.fatal is true and it encounters malformed data while decoding.

    Throws

    RangeError if called with invalid encoding argument or pid outside valid range: 0..PID_MAX inclusive.

    Throws

    SystemError if the underlying sysctl or parsing fails.

    Parameters

    • pid: number

      The pid of the process whose arguments you want, must be between 0..PID_MAX inclusive.

    • encoding: TextEncoding

      The encoding to attempt to apply to the arguments. Must be an enumerated value of TextEncoding.

    • Optional nuls: boolean

      Whether to replace nul bytes with spaces for human consumption.

    • Optional skip: number

      The number of leading args to skip past.

    • Optional options: {
          fatal?: boolean;
          ignoreBOM?: boolean;
      }

      The options to use when decoding the process' arguments' bytes into a string.

      • Optional fatal?: boolean
      • Optional ignoreBOM?: boolean

    Returns string

  • Gets the arguments of a process as an array of ArrayBuffers

    Returns

    An array of ArrayBuffers representing the arguments of pid.

    Throws

    TypeError if called with: missing pid, too many arguments, invalid number as pid.

    Throws

    RangeError if called with pid outside valid range: 0..PID_MAX inclusive.

    Throws

    SystemError if the underlying sysctl or parsing fails.

    Parameters

    • pid: number

      The pid of the process whose arguments you want, must be between 0..PID_MAX inclusive.

    Returns ArrayBuffer[]

  • Gets the arguments of a process as an ArrayBuffer

    Returns

    An ArrayBuffer representing the arguments of pid, formatted as requested.

    Throws

    TypeError if called with: missing pid argument, invalid number as pid, invalid number as skip.

    Throws

    RangeError if called with pid outside valid range: 0..PID_MAX inclusive.

    Throws

    SystemError if the underlying sysctl or parsing fails.

    Parameters

    • pid: number

      The pid of the process whose arguments you want, must be between 0..PID_MAX inclusive.

    • nuls: boolean

      Whether to replace nul bytes with spaces for human consumption.

    • skip: number

      The number of leading args to skip past.

    Returns ArrayBuffer

Generated using TypeDoc