{"id":22245429,"url":"https://github.com/niiknow/text-file-diff","last_synced_at":"2025-09-10T14:06:53.168Z","repository":{"id":49646579,"uuid":"104671379","full_name":"niiknow/text-file-diff","owner":"niiknow","description":"line by line diff of two large text files","archived":false,"fork":false,"pushed_at":"2023-09-06T16:00:17.000Z","size":48,"stargazers_count":11,"open_issues_count":3,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-28T02:49:01.837Z","etag":null,"topics":["compare","compare-files","diff","difference","differences"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/niiknow.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-09-24T19:43:19.000Z","updated_at":"2023-09-13T15:52:54.000Z","dependencies_parsed_at":"2024-06-18T23:00:20.658Z","dependency_job_id":"130955a4-90fb-4ff1-9665-449ddf91bca6","html_url":"https://github.com/niiknow/text-file-diff","commit_stats":{"total_commits":44,"total_committers":1,"mean_commits":44.0,"dds":0.0,"last_synced_commit":"215bbf9c9724727cde06b981cb5954b52915f5e4"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/niiknow/text-file-diff","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niiknow%2Ftext-file-diff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niiknow%2Ftext-file-diff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niiknow%2Ftext-file-diff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niiknow%2Ftext-file-diff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/niiknow","download_url":"https://codeload.github.com/niiknow/text-file-diff/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niiknow%2Ftext-file-diff/sbom","scorecard":{"id":686940,"data":{"date":"2025-08-11","repo":{"name":"github.com/niiknow/text-file-diff","commit":"215bbf9c9724727cde06b981cb5954b52915f5e4"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-22T01:11:23.918Z","repository_id":49646579,"created_at":"2025-08-22T01:11:23.918Z","updated_at":"2025-08-22T01:11:23.918Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274475400,"owners_count":25292402,"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","status":"online","status_checked_at":"2025-09-10T02:00:12.551Z","response_time":83,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["compare","compare-files","diff","difference","differences"],"created_at":"2024-12-03T05:14:46.685Z","updated_at":"2025-09-10T14:06:53.104Z","avatar_url":"https://github.com/niiknow.png","language":"TypeScript","readme":"[![Build Status](https://travis-ci.org/niiknow/text-file-diff.svg?branch=master)](https://travis-ci.org/niiknow/text-file-diff)\n# text-file-diff\n\u003e line by line diff of two large (sorted) text files\n\nThis is especially useful with csv/tsv/psv files:\n- compare products file for changes to import\n- compare log files \n- compare database export of large organization employee/users \n\n## NOTE\nThe benefits of this script is that it allow user full control of their file diffs.  It work great on large file because it does not require you to load the entire file into memory or string.\n\nThis script expect input of two `sorted` text files.  If the files are not sorted, the unix `sort` command may be of help: https://en.wikipedia.org/wiki/Sort_(Unix)\n\n```\nForEach line in File1, compare to line in File2 \n   equal: incr both files to next line\n   line1 \u003e line2: new line detected, incr File2 to next line\n   line1 \u003c line2: deleted line, incr File1 to next line\n```\n\nSince the list will be `sorted`, the performance of this script is expected to be approximately `O(|A| log |A| + |B| log |B|)`, where A is File1 and B is File2.\n\nThis library also has no dependency.\n\n## Install\n\n```bash\n$ npm install text-file-diff\n```\n\n## Usage\n```js\nimport TextFileDiff from 'text-file-diff';\nconst m = new TextFileDiff();\nm.on('compared', (line1, line2, compareResult, lineReader1, lineReader2) =\u003e {\n    // event triggered immediately after line comparison\n    // but before +- event\n  });\n\nm.on('-', line =\u003e {\n    // when a line is in file1 but not in file2\n  });\n\nm.on('+', line =\u003e {\n    // when a line is in file2 but not in file1\n  });\n\n// run the diff\nm.diff('tests/file1.txt', 'tests/file2.txt');\n\n// or run m.diffStream(stream1, stream2)\n```\n\n**TextFileDiff** constructor also accept optional options object.  Valid options are:\n1. `skipHeader` - boolean indicating if first line should be skipped\n2. `compareFn` - line comparer function that take in two line (line1 and line2), and `return line1 \u003e line2 ? 1 : (line1 \u003c line2 ? -1 : 0)` allowing you to define how you want to perform line compare.\n\n\u003e NOTE: use diffStream if you need control over encoding\n\n## Example\n```bash\n$ ./bin/text-file-diff tests/file1.txt tests/file2.txt\n```\n\n## Point of Interest\n\n* Alternate shell 'diff' command:\n```bash\n$ diff -u f1.txt f2.txt | sed -n '1,2d;/^[-+|]/p' | sed 's/^\\(.\\{1\\}\\)/\\1|/'\n```\n\n* https://github.com/paulfitz/daff - multi languages diff framework\n* https://github.com/kpdecker/jsdiff - popular nodejs string diff\n\n## MIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fniiknow%2Ftext-file-diff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fniiknow%2Ftext-file-diff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fniiknow%2Ftext-file-diff/lists"}