Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/replit/ruspty
PTY for Node through Rust FFI
https://github.com/replit/ruspty
forkpty pseudoterminal pty terminal
Last synced: 15 days ago
JSON representation
PTY for Node through Rust FFI
- Host: GitHub
- URL: https://github.com/replit/ruspty
- Owner: replit
- Created: 2024-01-23T16:00:56.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-11-12T19:47:46.000Z (about 2 months ago)
- Last Synced: 2024-12-14T05:33:01.218Z (20 days ago)
- Topics: forkpty, pseudoterminal, pty, terminal
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/@replit/ruspty
- Size: 233 KB
- Stars: 15
- Watchers: 17
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# `@replit/ruspty` - PTY for JavaScript through Rust FFI
A very thin wrapper around PTYs and processes.
```ts
const { Pty } = require('@replit/ruspty');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');
```## Local Development
- `npm install`
- `npm run build`
- `npm run test`## Publishing
Following ["Publish It" section from `napi-rs` docs](https://napi.rs/docs/introduction/simple-package#publish-it):
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](https://httptoolkit.com/blog/automatic-npm-publish-gha/).