{"id":17537701,"url":"https://github.com/bates64/iac","last_synced_at":"2026-05-17T09:38:41.609Z","repository":{"id":57270545,"uuid":"77406742","full_name":"bates64/iac","owner":"bates64","description":"Node.js interface to Telnet's Interpret As Command","archived":false,"fork":false,"pushed_at":"2016-12-27T15:42:14.000Z","size":10,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-15T15:17:57.192Z","etag":null,"topics":["iac","nodejs","socket","telnet"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bates64.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-26T21:01:32.000Z","updated_at":"2016-12-26T21:05:16.000Z","dependencies_parsed_at":"2022-09-06T21:52:39.623Z","dependency_job_id":null,"html_url":"https://github.com/bates64/iac","commit_stats":null,"previous_names":["nanalan/iac","bates64/iac"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bates64%2Fiac","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bates64%2Fiac/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bates64%2Fiac/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bates64%2Fiac/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bates64","download_url":"https://codeload.github.com/bates64/iac/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246135739,"owners_count":20729056,"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":["iac","nodejs","socket","telnet"],"created_at":"2024-10-20T20:42:33.062Z","updated_at":"2025-10-24T05:52:53.794Z","avatar_url":"https://github.com/bates64.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# iac\n\u003e Node.js interface to Telnet's Interpret As Command\n\n[![npm version](https://img.shields.io/npm/v/iac.svg)](https://www.npmjs.com/package/iac)\n[![npm downloads](https://img.shields.io/npm/dt/iac.svg)](https://www.npmjs.com/package/iac)\n[![license](https://img.shields.io/github/license/nanalan/iac.svg)](LICENSE)\n\nInstall with npm:\n```sh\n$ npm install --save iac\n```\n\n`iac` relies on es6 `Proxy`, therefore you must use **Node.js version 6.0.0 or above**.\n\n## Examples\n#### As the server\n```js\nconst net = require('net')\nconst iac = require('iac')\n\nnet\n  .createServer(sock =\u003e {\n    // IAC WILL ECHO\n    sock.write(iac.will.echo)\n\n    // Handler for IAC SB NAWS\n    iac.on(sock, iac.sb.naws, (width, height) =\u003e {\n      console.log(`Remote terminal is ${width}x${height}`)\n    })\n  })\n  .listen(3000)\n```\n\n##### As the client\n```js\nconst net = require('net')\nconst iac = require('iac')\n\nnet\n  .createConnection('localhost', 3000)\n  .on('connect', conn =\u003e {\n    // IAC SB NAWS 0 80 0 24 IAC SE\n    //  A window 80 characters wide, 24 characters high\n    //  See RFC 1073\n\n    conn.write(iac.sb.naws(80, 24))\n  })\n```\n\n## API\n`iac.OPERATION.OPTION` will always be a `Buffer`, where:\n\n**OPERATION** is one of:\n- will\n- wont\n- do\n- dont\n- sb [(special case)](#subnegotiation)\n\n**OPTION** is one of:\n- binary (Binary Transmission)\n- echo\n- suppress (Suppress Go Ahead)\n- status [not fully supported]\n- timing (Timing Mark)\n- terminal (Terminal Type)\n- naws (Negotiate About Window Size)\n- speed (Terminal Speed)\n- flow (Remote Flow Control)\n- linemode\n- env (Environment Variables)\n\nBoth OPERATION and OPTION are **case insensitive**. If either are not one of the operations/options listed then it shall return `undefined`.\n\ne.g.\n```js\nconst iac = require('iac')\n\n// IAC DONT SUPPRESS-GO-AHEAD\niac.dont.suppress\n\n// IAC WILL LINEMODE\niac.will.linemode \n```\n\n### Subnegotiation\nTo use subnegotiation, _call_ `iac.sb.OPTION()`:\n\n- **Strings** are interpolated into ASCII\n- **Numbers** are passed directly\n- Passing **no arguments** implies subnegotiation _value required_ (1).\n\ne.g.\n```js\nconst iac = require('iac')\n\n// IAC SB NAWS 0 80 0 24 IAC SE\niac.sb.naws(80, 24)\n\n// IAC SB TERMINAL-TYPE 1 IAC SE\niac.sb.terminal()\n```\n\n### On\n`iac` also provides support for **assigning handlers for socket data of specific IAC commands** on a socket with `iac.on(socket, command, handler)`. _command_ should be something like `iac.do.suppress` or `iac.sb.status`.\n\ne.g.\n```js\nconst net = require('net')\nconst iac = require('iac')\n\nnet\n  .createServer(sock =\u003e {\n    // Do not use `sock.setEncoding` at any point if using `iac.on(sock)`\n\n    // Handlers...\n    iac\n      .on(sock, iac.will.naws, () =\u003e console.log(`Remote will NAWS`))\n      .on(sock, iac.wont.naws, () =\u003e console.log(`Remote wont NAWS`))\n      .on(sock, iac.sb.naws, (width, height) =\u003e {\n        // Note encoding is operation-specific\n        console.log(`Remote terminal size is ${width}x${height}`)\n      })\n\n    // Ask socket to negotiate window size\n    sock.write(iac.do.naws)\n  })\n  .listen(3000)\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbates64%2Fiac","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbates64%2Fiac","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbates64%2Fiac/lists"}