{"id":18523700,"url":"https://github.com/sonicdoe/teletype","last_synced_at":"2026-04-28T17:03:29.125Z","repository":{"id":66035289,"uuid":"78941842","full_name":"sonicdoe/teletype","owner":"sonicdoe","description":"A simple Telnet client.","archived":false,"fork":false,"pushed_at":"2017-02-03T20:44:56.000Z","size":22,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-14T19:11:19.636Z","etag":null,"topics":["es2015","javascript","nodejs","semver","telnet","telnet-client"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sonicdoe.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-01-14T13:28:47.000Z","updated_at":"2019-01-09T15:27:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"815a3f8f-c8f6-43d1-ba93-64bc8112b52f","html_url":"https://github.com/sonicdoe/teletype","commit_stats":{"total_commits":37,"total_committers":1,"mean_commits":37.0,"dds":0.0,"last_synced_commit":"a01f78e851a96eff7fe77d939edfe23a59e47ee9"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/sonicdoe/teletype","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sonicdoe%2Fteletype","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sonicdoe%2Fteletype/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sonicdoe%2Fteletype/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sonicdoe%2Fteletype/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sonicdoe","download_url":"https://codeload.github.com/sonicdoe/teletype/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sonicdoe%2Fteletype/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259845776,"owners_count":22920798,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["es2015","javascript","nodejs","semver","telnet","telnet-client"],"created_at":"2024-11-06T17:37:11.646Z","updated_at":"2026-04-28T17:03:24.086Z","avatar_url":"https://github.com/sonicdoe.png","language":"JavaScript","readme":"# Teletype\n\n[![Node.js package](https://img.shields.io/npm/v/teletype.svg)](https://www.npmjs.com/package/teletype)\n[![Build status](https://img.shields.io/travis/sonicdoe/teletype.svg)](https://travis-ci.org/sonicdoe/teletype)\n\n\u003e A simple Telnet client.\n\n## Installation\n\n```sh\n$ npm install teletype --save\n```\n\n## Usage\n\n```js\nconst teletype = require('teletype')\nconst client = teletype('localhost')\n\nclient.exec('?PWR', /PWR[01]/)\n  .then(response =\u003e {\n    console.log(response) // PWR0\n  })\n```\n\n### API\n\n#### teletype(host[, port, options])\n\nCreates a Teletype client.\n\n##### host\n\nType: `String`\n\nThe hostname or IP address of the host to connect to.\n\n##### port\n\nType: `Number`  \nDefault: `23`\n\nThe port to connect to.\n\n##### options\n\nType: `Object`\n\n###### timeout\n\nType: `Number` or `false`  \nDefault: `false`\n\nThe number of milliseconds before a call is considered to be timed out. This\napplies to the initial connection, `readUntil()`, and `exec()` if called with\n`match`. `exec()` without `match` and `close()` will never time out.\n\n#### client.exec(command[, match])\n\nSends a command to the host and reads incoming data until `match` is\nencountered. If `match` is given, it returns a promise for a `response` string\nwhich contains the first line where `match` was encountered.\n\n##### command\n\nType: `String`\n\nThe command to send to the host.\n\n##### match\n\nType: `RegExp`\n\nThe regular expression to match against incoming data. If omitted, Teletype\nwon’t read any incoming data but will send the command to the host.\n\n#### client.readUntil(match)\n\nReads incoming data from the host until `match` is encountered. Returns a\npromise for a `response` string which contains the first line where `match`\nwas encountered.\n\n#### client.close()\n\n[Sends a FIN packet](https://nodejs.org/dist/latest-v6.x/docs/api/net.html#net_socket_end_data_encoding)\nand\n[destroys the socket](https://nodejs.org/dist/latest-v6.x/docs/api/net.html#net_socket_destroy_exception).\n\n### Errors\n\nIf a required argument is missing, Teletype will reject a `TypeError`.\nIf a call times out, it will reject an error with the code `ETIMEDOUT`.\nAny other error will be the same as emitted by\n[Node.js’s `net`](https://nodejs.org/dist/latest-v6.x/docs/api/net.html#net_event_error_1).\n\n## Acknowledgments\n\nTeletype is inspired by [Ruby’s `Net::Telnet`](https://github.com/ruby/net-telnet)\nand [Python’s `telnetlib`](https://docs.python.org/3.6/library/telnetlib.html).\n\nIf you need something more advanced, take a look at\n[`telnet-client`](https://github.com/mkozjak/node-telnet-client).\n\n## License\n\nTeletype itself is licensed under the ISC license. See [`LICENSE`](./LICENSE)\nfor the full license.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsonicdoe%2Fteletype","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsonicdoe%2Fteletype","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsonicdoe%2Fteletype/lists"}