{"id":19232667,"url":"https://github.com/makeomatic/fingerprint","last_synced_at":"2025-04-21T04:32:39.512Z","repository":{"id":42870358,"uuid":"47557021","full_name":"makeomatic/fingerprint","owner":"makeomatic","description":"returns hash digest (fingerprint) of a given file or stream in node.js","archived":false,"fork":false,"pushed_at":"2022-03-26T14:06:20.000Z","size":392,"stargazers_count":1,"open_issues_count":8,"forks_count":1,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-11T04:49:22.106Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/makeomatic.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":"2015-12-07T14:28:50.000Z","updated_at":"2020-04-23T20:44:11.000Z","dependencies_parsed_at":"2022-09-26T16:22:38.565Z","dependency_job_id":null,"html_url":"https://github.com/makeomatic/fingerprint","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makeomatic%2Ffingerprint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makeomatic%2Ffingerprint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makeomatic%2Ffingerprint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makeomatic%2Ffingerprint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/makeomatic","download_url":"https://codeload.github.com/makeomatic/fingerprint/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249988367,"owners_count":21356798,"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-11-09T16:07:07.845Z","updated_at":"2025-04-21T04:32:39.245Z","avatar_url":"https://github.com/makeomatic.png","language":"TypeScript","readme":"# Node.js file fingerprinting\n\nReturns hash digest (fingerprint) of a given file or stream in node.js\nAny hash algorithm that node.js crypto supports can be given.\n\n## Install\n\n`npm i fprint -S`\n\n## API\n\nPackage includes TypeScript definitions.\n\n### fprint\n\n```ts\nfunction fprint(source: Buffer | string | ReadStream, algorithm: string): Promise\u003cstring\u003e\n```\n\nReturns a Promise that resolves to a string with algorithm hex hash digest for a given *input*.\n*input* - either `Buffer`, `ReadStream` or file path. Supports both relative and absolute paths\n\n```ts\nconst fprint = require('fprint');\nconst fs = require('fs');\nconst filepath = '/path/to/file';\nconst stream = fs.createReadStream(filepath);\nconst fileContents = fs.readFileSync(filepath);\n\nlet shasum = await fprint(file, 'sha256');\n\nlet sha256 = fprint(stream, 'sha256');\n\nlet shasum = await fprint(filepath, 'sha256')\n```\n\n### digestSync\n\n```ts\nfunction digestSync(buffer: Buffer, algorithm: string): string\n```\n\nAccepts Buffer and creates it's digest\n\n```ts\nconst { digestSync } = require('fprint');\n\nconst fs = require('fs');\nconst file = fs.readFileSync('/path/to/file.min.js');\nconst md5 = digestSync(file, 'md5');\n```\n\n### digestStream\n\n```ts\nfunction digestStream(stream: ReadStream, algorithm: string): Promise\u003cstring\u003e\n```\n\nAccepts stream and creates it's digest\n\n## Testing\n\n1. `shasum -a 256 ./test/fixtures/files/* | awk '{print $1}' \u003e ./test/fixtures/sums/sha256`\n2. `md5 -q ./test/fixtures/files/* \u003e ./test/fixtures/sums/md5`\n3. `npm test`\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmakeomatic%2Ffingerprint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmakeomatic%2Ffingerprint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmakeomatic%2Ffingerprint/lists"}