1.0.4 • Published 1 year ago

tt-native v1.0.4

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

tt-native

https://github.com/holepunchto/libtt JavaScript bindings for Node.js.

npm install tt-native

Usage

const { spawn } = require('tt-native')

const pty = spawn('node', ['script.js'])

API

const pty = spawn(file[, args][, options])

Spawn a process attached to a pseudo TTY. The returned PTY is a duplex stream.

Options include:

{
  width: 80,
  height: 60,
  env: process.env,
  cwd: process.cwd()
}

pty.width

The current width of the PTY.

pty.height

The current height of the PTY.

pty.pid

The process ID of the spawned process.

pty.on('exit', code[, signal])

Emitted when the process exit.

pty.resize(width, height)

Resize the PTY.

pty.kill([signal])

Kill the process with the specified signal, which defaults to SIGINT. The following signals may be used:

  • SIGINT
  • SIGKILL
  • SIGTERM

License

ISC