Giter VIP home page Giter VIP logo

ruspty's Introduction

@replit/ruspty - PTY for JavaScript through Rust FFI

A very thin wrapper around PTYs and processes.

const { Pty } = require('@replit/ruspty');
const fs = require('fs');

const pty = new Pty({
  command: '/bin/sh',
  args: [],
  envs: {},
  size: { rows: 24, cols: 80 },
  onExit: (...result) => {
    // TODO: Handle process exit.
  },
});

const read = pty.read;
const write = pty.write;

read.on('data', (chunk) => {
  // TODO: Handle data.
});
write.write('echo hello\n');

The biggest difference from existing PTY libraries is that this one works with Bun, and doesn't cross the FFI bridge for every input/output instead requiring the consumer to deal with the fd of the PTY.

Local Development

  • npm install
  • npm run build
  • npm run test

Publishing

Following "Publish It" section from napi-rs docs:

  1. git clean -f && npm install && npm run build
  2. npm version [major|minor|patch]
  3. Send that as a Pull Request to GitHub. Ensure that the commit message consisting only of x.y.z - this is how the CI decides to publish to npm!

NPM_TOKEN is part of the repo secrets, generated like this.

ruspty's People

Contributors

szymonkaliski avatar lhchavez avatar jackyzha0 avatar masad-frost avatar dependabot[bot] avatar

Stargazers

Sagnik avatar LuisAFK avatar George Kontridze avatar Karan Janthe avatar Sanjay Achar avatar Ray avatar Phil MacEachron avatar  avatar  avatar

Watchers

 avatar Ertan Dogrultan avatar David Hoang avatar Alexis Cervantes avatar Matt Legrand avatar  avatar James Austin avatar Harrison Unruh avatar  avatar Prahathess avatar Arnav Bansal avatar Connor Brewster avatar  avatar Olivia Chen avatar Edgar Hernandez avatar  avatar

Forkers

waheedmirza

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.