{"id":13583203,"url":"https://github.com/mafintosh/ansi-diff-stream","last_synced_at":"2025-04-09T18:16:55.348Z","repository":{"id":43445071,"uuid":"63357769","full_name":"mafintosh/ansi-diff-stream","owner":"mafintosh","description":"A transform stream that diffs input buffers and outputs the diff as ANSI. If you pipe this to a terminal it will update the output with minimal changes","archived":false,"fork":false,"pushed_at":"2018-03-23T02:32:28.000Z","size":9,"stargazers_count":109,"open_issues_count":2,"forks_count":12,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-09T18:16:50.411Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/mafintosh.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-07-14T17:52:44.000Z","updated_at":"2025-01-17T03:47:20.000Z","dependencies_parsed_at":"2022-09-14T03:31:51.777Z","dependency_job_id":null,"html_url":"https://github.com/mafintosh/ansi-diff-stream","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mafintosh%2Fansi-diff-stream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mafintosh%2Fansi-diff-stream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mafintosh%2Fansi-diff-stream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mafintosh%2Fansi-diff-stream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mafintosh","download_url":"https://codeload.github.com/mafintosh/ansi-diff-stream/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248085323,"owners_count":21045139,"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":[],"created_at":"2024-08-01T15:03:19.499Z","updated_at":"2025-04-09T18:16:55.314Z","avatar_url":"https://github.com/mafintosh.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","Input"],"sub_categories":[],"readme":"# ansi-diff-stream\n\nA transform stream that diffs input buffers and outputs the diff as ANSI.\nIf you pipe this to a terminal it will update the output with minimal changes.\n\n```\nnpm install ansi-diff-stream\n```\n\n[![build status](http://img.shields.io/travis/mafintosh/ansi-diff-stream.svg?style=flat)](http://travis-ci.org/mafintosh/ansi-diff-stream)\n\n## Usage\n\n``` js\nvar differ = require('ansi-diff-stream')\nvar diff = differ()\n\nsetInterval(function () {\n  diff.write(\n    'This is a demo\\n' +\n    'The time is: ' + new Date() + '\\n' +\n    'That is all'\n  )\n}, 500)\n\ndiff.pipe(process.stdout)\n```\n\nRunning the above example will produce an output that looks like this:\n\n```\nThis is a demo\nThe time is: Thu Jul 14 2016 19:46:56 GMT+0200 (CEST)\nThat is all\n```\n\nEvery half second the time will update.\nThe diff produced by running the above means that the terminal will move the cursor to the beginning of the time stamp only update that part.\n\nFor a more advanced example see `example.js`.\n\n## API\n\n#### `var stream = differ()`\n\nCreate a new diff stream. You should pipe it to a ansi capable stream.\n\n#### `stream.reset()`\n\nWill reset the diff. Useful you print something manually inbetween updates.\n\n#### `stream.clear()`\n\nClear the last printed output from the screen. Similar to doing `stream.write('')`.\n\n## CLI\n\nThere is a command line tools available as\n\n```\nnpm install -g ansi-diff-stream\nnc -l 10000 | ansi-diff-stream\n```\n\nIn another terminal\n\n```\nnc localhost 10000\nhello\nworld\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmafintosh%2Fansi-diff-stream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmafintosh%2Fansi-diff-stream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmafintosh%2Fansi-diff-stream/lists"}