rustybun
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

RustyBun

Readline implementation in Rust for Bun. RustyLine Bun ffi wrapper.

Install

bun add rustybun

Usage

import RustyBun from 'rustybun'

const rb = new RustyBun()

const { success } = rb.loadHistory('history.txt')
if (!success) {
  console.log('No previous history.')
}

while (true) {
  const line = rb.readline();
  if (line.signal === 'CtrlC') {
    console.log('CtrlC')
    break
  }
  if (line.signal === 'CtrlD') {
    console.log('CtrlD')
    break
  }
  console.log(line.value)
}

rb.saveHistory('history.txt')

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i rustybun

Weekly Downloads

3

Version

0.2.0

License

MIT

Unpacked Size

14.6 MB

Total Files

10

Last publish

Collaborators

  • wobsoriano