{"id":19560672,"url":"https://github.com/zoubin/util-equal","last_synced_at":"2025-07-21T15:04:35.968Z","repository":{"id":57389013,"uuid":"42506388","full_name":"zoubin/util-equal","owner":"zoubin","description":"Utils for checking file contents","archived":false,"fork":false,"pushed_at":"2015-09-16T03:19:44.000Z","size":144,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-19T18:13:57.738Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zoubin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-09-15T08:52:15.000Z","updated_at":"2015-09-16T03:19:40.000Z","dependencies_parsed_at":"2022-09-19T02:32:50.361Z","dependency_job_id":null,"html_url":"https://github.com/zoubin/util-equal","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/zoubin/util-equal","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoubin%2Futil-equal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoubin%2Futil-equal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoubin%2Futil-equal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoubin%2Futil-equal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zoubin","download_url":"https://codeload.github.com/zoubin/util-equal/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoubin%2Futil-equal/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266324443,"owners_count":23911226,"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-07-21T11:47:31.412Z","response_time":64,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":[],"created_at":"2024-11-11T05:08:26.388Z","updated_at":"2025-07-21T15:04:35.937Z","avatar_url":"https://github.com/zoubin.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# util-equal\nUtils for checking file contents.\n\nSupport four cases:\n\n* Streams v.s. Streams.\n* Filenames v.s. filenames.\n* Streams v.s. filenames.\n* Streams v.s. contents.\n\n## Example\n\n```javascript\nvar equal = require('util-equal');\nvar fs = require('fs');\nvar path = require('path');\nvar filename = path.join(__dirname, 'source');\nvar expected = path.join(__dirname, 'source.expected');\n\nequal(\n  fs.createReadStream(filename),\n  fs.createReadStream(expected),\n  function (res) {\n    console.log('stream v.s. stream', res);\n  }\n);\n\nequal(\n  filename,\n  expected,\n  function (res) {\n    console.log('filename v.s. filename', res);\n  }\n);\n\nequal(\n  fs.createReadStream(filename),\n  expected,\n  function (res) {\n    console.log('stream v.s. filename', res);\n  }\n);\n\nequal.str(\n  fs.createReadStream(filename),\n  fs.readFileSync(expected, 'utf8'),\n  function (res) {\n    console.log('stream v.s. contents', res);\n  }\n);\n\n```\n\noutputs:\n\n```\n⌘ node example/equal.js\nstream v.s. stream true\nfilename v.s. filename true\nstream v.s. filename true\nstream v.s. contents true\n```\n\n## API\n\n### equal(actual, expected, done)\n\nCheck whether file contents are the same.\n\n#### actual, expected\n\nType: `Stream`, `String`, `Array`\n\nIf `Stream`, should flow the file contents.\nIf `String`, should be the filename.\nIf `Array`, each element should be `Stream` or `String`.\n\n#### done(res)\n\nIf contents equal, `res` will be `true`, otherwise `false`.\n\n### equal.str(actual, expected, done)\n\nThe only difference from `equal` is that `String` is treated as file contents rather than filename.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzoubin%2Futil-equal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzoubin%2Futil-equal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzoubin%2Futil-equal/lists"}