{"id":22273095,"url":"https://github.com/mac-/hash-files","last_synced_at":"2025-07-28T14:31:48.535Z","repository":{"id":13708297,"uuid":"16402243","full_name":"mac-/hash-files","owner":"mac-","description":"A simple function for computing the hash of the contents of a set of files.","archived":false,"fork":false,"pushed_at":"2017-03-20T00:28:21.000Z","size":15,"stargazers_count":30,"open_issues_count":5,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-08T09:50:49.338Z","etag":null,"topics":["hash","javascript"],"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/mac-.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":"2014-01-31T07:29:22.000Z","updated_at":"2023-05-15T15:21:01.000Z","dependencies_parsed_at":"2022-09-14T22:02:56.093Z","dependency_job_id":null,"html_url":"https://github.com/mac-/hash-files","commit_stats":null,"previous_names":["mac-/hash-dir-contents"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mac-%2Fhash-files","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mac-%2Fhash-files/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mac-%2Fhash-files/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mac-%2Fhash-files/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mac-","download_url":"https://codeload.github.com/mac-/hash-files/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227922961,"owners_count":17840940,"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":["hash","javascript"],"created_at":"2024-12-03T13:09:44.430Z","updated_at":"2024-12-03T13:09:44.969Z","avatar_url":"https://github.com/mac-.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hash-files\n\nA simple function for computing the hash of the contents of a set of files.\n\n\n[![Build Status](https://secure.travis-ci.org/mac-/hash-files.png)](http://travis-ci.org/mac-/hash-files)\n[![Coverage Status](https://coveralls.io/repos/mac-/hash-files/badge.png)](https://coveralls.io/r/mac-/hash-files)\n[![NPM version](https://badge.fury.io/js/hash-files.png)](http://badge.fury.io/js/hash-files)\n[![Dependency Status](https://david-dm.org/mac-/hash-files.png)](https://david-dm.org/mac-/hash-files)\n\n[![NPM](https://nodei.co/npm/hash-files.png?downloads=true\u0026stars=true)](https://nodei.co/npm/hash-files/)\n\n## Installation\n\n\tnpm install hash-files\n\n## Usage\n\n```js\nvar hashFiles = require('hash-files');\n\n// options is optional\nhashFiles(options, function(error, hash) {\n\t// hash will be a string if no error occurred\n});\n```\n\nOr on the command line:\n\n```shell\n$ ./bin/hash-files -h\n\n  Usage: hash-files [options]\n\n  Options:\n\n    -h, --help                  output usage information\n    -V, --version               output the version number\n    -f, --files [array]         (Optional) A collection of file paths to hash the contents of. Defaults to: ./**\n    -a, --algorithm [string]    (Optional) The algorithm to use to hash the content. Defaults to: \"sha1\"\n    -n, --no-glob               (Optional) Use this if you know all of the files in the collection are exact paths. Setting this to true speeds up the call slightly. Defaults to: false\n    -c, --batch-count [number]  (Optional) The maximum number of files to read into memory at any given time. Defaults to: 100\n```\n\n```shell\n$ ./bin/hash-files -f '[\"package.json\"]' -a sha256\na29089cc5e3f8bf6ae15ea6b9cd5eaefb14bbb12e3baa2c56ee5c21422250c75\n```\n\n### hashFiles([options], callback)\n\nPerforms a hash of the contents of the given files ansynchronously.\n\n* `options` - (Object) see below for more details\n* `callback` - (Function) called when an error occurs or the hash is completed. Should expect the following arguments:\n\t* `error` - (Error or null) the error the occurred while hashing the contents of the given files or null if there was no error\n\t* `hash` - (String) the value of the computed hash\n\n### hashFiles.sync([options])\n\nPerforms a hash of the contents of the given files synchronously.\n\n* `options` - (Object) see below for more details\n* returns `hash` - (String) the value of the computed hash\n\n### Options\n\n* `files` - (optional) A collection of file paths to hash the contents of. Defaults to `['./**']` (all the files in the current working directory)\n* `algorithm` - (optional) The algorithm to use to hash the content: 'md5', 'sha', 'sha1', 'sha224', 'sha256', 'sha384', or 'sha512'. Defaults to 'sha1'.\n* `noGlob` - (optional) Don't bother running a glob function on the files. Use this if you know all of the files in the collection are exact paths. Setting this to `true` speeds up the call slightly.\n* `batchCount` - (optional) Only used for the ansyc function. The maximum number of files to read into memory at any given time. Defaults to 100.\n\n\n## License\n\nThe MIT License (MIT) Copyright (c) 2013 Mac Angell\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmac-%2Fhash-files","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmac-%2Fhash-files","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmac-%2Fhash-files/lists"}