bare-process
Node.js-compatible process control for Bare
stable
bare-process — Node.js-compatible process control for Bare.
Mirrors the Node.js process module.
npm i bare-processUsage
const process = require('bare-process')
process.exit()To make the process object globally available, do:
require('bare-process/global')API
Types
ProcessEvents
interface ProcessEvents {
beforeExit: [code: number]
exit: [code: number]
idle: []
resume: []
suspend: [linger: number]
uncaughtException: [err: unknown]
unhandledRejection: [reason: unknown, promise: Promise<unknown>]
SIGBREAK: []
SIGHUP: []
SIGINT: []
SIGPIPE: []
SIGTERM: []
SIGWINCH: []
}Events emitted by process.
Process
interface Process<M extends ProcessEvents = ProcessEvents> {
readonly stdin: typeof stdio.in
readonly stdout: typeof stdio.out
readonly stderr: typeof stdio.err
readonly arch: ReturnType<typeof os.arch>
readonly argv: string[]
readonly env: Record<string, string>
readonly execArgv: string[]
readonly execPath: string
readonly hrtime: typeof hrtime
readonly pid: number
readonly platform: ReturnType<typeof os.platform>
readonly ppid: number
readonly version: string
readonly versions: Record<string, string>
exitCode: number
title: string
exit(code?: number): never
suspend(): void
resume(): void
cwd(): string
chdir(dir: string): string
kill(pid: number, signal?: string | number): void
uptime(): number
abort: typeof abort
cpuUsage: typeof os.cpuUsage
threadCpuUsage: typeof os.threadCpuUsage
resourceUsage: typeof os.resourceUsage
availableMemory: typeof os.availableMemory
constrainedMemory: typeof os.constrainedMemory
memoryUsage: typeof os.memoryUsage
getgid: typeof posix.getgid
setgid: typeof posix.setgid
getegid: typeof posix.getegid
setegid: typeof posix.setegid
getuid: typeof posix.getuid
setuid: typeof posix.setuid
geteuid: typeof posix.geteuid
seteuid: typeof posix.seteuid
getgroups: typeof posix.getgroups
nextTick<T extends unknown[]>(cb: (...args: T) => unknown, ...args: T): void
addListener<E extends keyof M, R>(name: E, fn: EventHandler<M[E], R>): this
addOnceListener<E extends keyof M, R>(name: E, fn: EventHandler<M[E], R>): this
prependListener<E extends keyof M, R>(name: E, fn: EventHandler<M[E], R>): this
prependOnceListener<E extends keyof M, R>(name: E, fn: EventHandler<M[E], R>): this
removeListener<E extends keyof M, R>(name: E, fn: EventHandler<M[E], R>): this
removeAllListeners<E extends keyof M>(name?: E): this
on<E extends keyof M, R>(name: E, fn: EventHandler<M[E], R>): this
once<E extends keyof M, R>(name: E, fn: EventHandler<M[E], R>): this
off<E extends keyof M, R>(name: E, fn: EventHandler<M[E], R>): this
emit<E extends keyof M>(name: E, ...args: M[E]): boolean
listeners<E extends keyof M, R>(name: E): EventHandler<M[E], R>
rawListeners<E extends keyof M, R>(name: E): EventHandler<M[E], R>[]
eventNames(): (keyof M)[]
listenerCount<E extends keyof M>(name: E): number
getMaxListeners(): number
setMaxListeners(n: number): void
}Alias for the type of the global process object.
bare-process/global
Types
global.Process
type Process = typeof processAlias for the type of the global process object.
See also
- Bare modules — the full
bare-*catalog. - Bare runtime API — the runtime these modules extend.