{"id":47223798,"url":"https://github.com/awwit/node-is-file-equal-buffer","last_synced_at":"2026-03-13T19:18:22.723Z","repository":{"id":42874947,"uuid":"257300221","full_name":"awwit/node-is-file-equal-buffer","owner":"awwit","description":"Compare file contents with buffer (check for content equality)","archived":false,"fork":false,"pushed_at":"2023-01-06T06:01:53.000Z","size":1130,"stargazers_count":0,"open_issues_count":7,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-20T21:32:23.326Z","etag":null,"topics":["buffer","compare","comparison","equal","file","nodejs"],"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/awwit.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":"2020-04-20T14:06:31.000Z","updated_at":"2021-06-20T11:09:51.000Z","dependencies_parsed_at":"2023-02-05T12:00:32.741Z","dependency_job_id":null,"html_url":"https://github.com/awwit/node-is-file-equal-buffer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/awwit/node-is-file-equal-buffer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awwit%2Fnode-is-file-equal-buffer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awwit%2Fnode-is-file-equal-buffer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awwit%2Fnode-is-file-equal-buffer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awwit%2Fnode-is-file-equal-buffer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/awwit","download_url":"https://codeload.github.com/awwit/node-is-file-equal-buffer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awwit%2Fnode-is-file-equal-buffer/sbom","scorecard":{"id":219709,"data":{"date":"2025-08-11","repo":{"name":"github.com/awwit/node-is-file-equal-buffer","commit":"f5a0e6d0dbf3eb7e3e625abd67eba05ec03fe9cf"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2,"checks":[{"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/16 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":"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":"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":"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":"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":"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":"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":"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":"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":"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":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"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"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 4 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"23 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-w8qv-6jwh-64r5","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-17T02:14:28.324Z","repository_id":42874947,"created_at":"2025-08-17T02:14:28.324Z","updated_at":"2025-08-17T02:14:28.324Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30473039,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-13T17:15:31.527Z","status":"ssl_error","status_checked_at":"2026-03-13T17:15:22.394Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["buffer","compare","comparison","equal","file","nodejs"],"created_at":"2026-03-13T19:18:22.016Z","updated_at":"2026-03-13T19:18:22.716Z","avatar_url":"https://github.com/awwit.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Is File Equal Buffer\n\nThis module has the function `isFileEqualBuffer` to compare file contents and buffer.\n\nThe function runs asynchronously and returns a `Promise` with resolved `boolean`.\n\n`isFileEqualBuffer(filePath, buffer[, options])`\n\n- `filePath` [string] | [Buffer] | [URL] path to the file you want to compare.\n- `buffer` [Buffer] buffer with which to compare file contents.\n- `options` [Object]\n  - `fs` [FileSystem](https://nodejs.org/api/fs.html) file system module (`fs`). __Default:__ `require('fs')`.\n- Returns: [Promise]\u003c[boolean]\u003e `true` if the contents of the file and buffer are equal, `false` — if not equal.\n\n[URL]: https://nodejs.org/api/url.html#url_the_whatwg_url_api\n[string]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type\n[Buffer]: https://nodejs.org/api/buffer.html#buffer_class_buffer\n[Object]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object\n[boolean]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type\n[Promise]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise\n\n## Examples\n\n```js\nconst { isFileEqualBuffer } = require('is-file-equal-buffer')\n\nconst filePath = 'path/to/file'\nconst buffer = Buffer.from('buffer content')\n\nisFileEqualBuffer(filePath, buffer).then(function checkIsEqual(isEqual) {\n  if (isEqual) {\n    // Do something if their contents are equal\n  } else {\n    // Do something if their contents are NOT equal\n  }\n})\n```\n\nYou can also provide your own modified `fs` module.\n\n```js\nconst { isFileEqualBuffer } = require('is-file-equal-buffer')\n\nconst fs = require('graceful-fs') // \u003c-- modified `fs` module\n\nconst filePath = 'path/to/file'\nconst buffer = Buffer.from('buffer content')\n\nisFileEqualBuffer(filePath, buffer, { fs }).then(function checkIsEqual(isEqual) { /* ... */ })\n```\n\n## How it works (inside)\n\nThe comparison function is made in the most optimal way:\n\n1. First, the function compares file and buffer sizes.\n2. If the file does not exist, the function will return `false`.\n3. If the file and buffer sizes are the same: a stream of reading data from a file is created (`fs.createReadStream`), and as new data arrives from the stream, they are compared with the buffer.\n4. As soon as an inequality of the contents of the file and the buffer is detected, the read stream closes and the function returns `false`.\n5. The function will return `true` only if the contents of the file and buffer completely match.\n\n## Motivation\n\nThis can be useful not to overwrite files that do not change after processing ([and save a erase cycles for SSD as example](https://en.wikipedia.org/wiki/Wear_leveling#Rationale)).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawwit%2Fnode-is-file-equal-buffer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fawwit%2Fnode-is-file-equal-buffer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawwit%2Fnode-is-file-equal-buffer/lists"}