LogoPear Docs

bare-stdio

Standard input/output streams for Bare

stable

bare-stdio — Standard input/output streams for Bare. It is a native addon.

npm i bare-stdio

Usage

const stdio = require('bare-stdio')

// Write to stdout
stdio.out.write('Hello, World!\n')

// Write to stderr
stdio.err.write('An error occurred\n')

// Read from stdin
stdio.in.on('data', (data) => {
  console.log('Received:', data.toString())
})

API

Constants and variables

io: IO

Source

The standard I/O streams: in — a readable stream for standard input (fd 0), out — a writable stream for standard output (fd 1), and err — a writable stream for standard error (fd 2). Each is created lazily on first access: a bare-tty stream if the file descriptor is a terminal, a bare-pipe Pipe if it's a pipe, otherwise a bare-fs stream.

See also

On this page