{"id":16834708,"url":"https://github.com/mscdex/node-xxhash","last_synced_at":"2025-04-05T08:04:23.178Z","repository":{"id":3447783,"uuid":"4500947","full_name":"mscdex/node-xxhash","owner":"mscdex","description":"An xxhash binding for node.js","archived":false,"fork":false,"pushed_at":"2020-08-05T06:59:23.000Z","size":145,"stargazers_count":193,"open_issues_count":13,"forks_count":28,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-10-14T12:07:32.149Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mscdex.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":"2012-05-30T21:43:20.000Z","updated_at":"2024-06-18T23:53:28.000Z","dependencies_parsed_at":"2022-09-17T07:02:22.379Z","dependency_job_id":null,"html_url":"https://github.com/mscdex/node-xxhash","commit_stats":{"total_commits":50,"total_committers":7,"mean_commits":7.142857142857143,"dds":"0.43999999999999995","last_synced_commit":"01ac70efff4147000c9d22d627613dcb6c7252b5"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mscdex%2Fnode-xxhash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mscdex%2Fnode-xxhash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mscdex%2Fnode-xxhash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mscdex%2Fnode-xxhash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mscdex","download_url":"https://codeload.github.com/mscdex/node-xxhash/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247305932,"owners_count":20917208,"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-10-13T12:07:30.821Z","updated_at":"2025-04-05T08:04:23.162Z","avatar_url":"https://github.com/mscdex.png","language":"C++","readme":"\nDescription\n===========\n\nAn [xxhash](https://github.com/Cyan4973/xxHash) binding for [node.js](http://nodejs.org/).\n\n[![Build Status](https://travis-ci.org/mscdex/node-xxhash.svg?branch=master)](https://travis-ci.org/mscdex/node-xxhash)\n[![Build status](https://ci.appveyor.com/api/projects/status/y2f8pisjshf4g181)](https://ci.appveyor.com/project/mscdex/node-xxhash)\n\n\nRequirements\n============\n\n* [node.js](http://nodejs.org/) -- v4.0.0 or newer\n\n\nInstall\n============\n\n    npm install xxhash\n\n\nExamples\n========\n\n* Hash a file in one step:\n\n```javascript\nvar XXHash = require('xxhash');\nvar fs = require('fs');\n\nvar file = fs.readFileSync('somefile');\nvar result = XXHash.hash(file, 0xCAFEBABE);\n```\n\n* Hash a file in multiple steps:\n\n```javascript\nvar XXHash = require('xxhash');\nvar fs = require('fs');\n\nvar hasher = new XXHash(0xCAFEBABE);\n\nfs.createReadStream('somefile')\n  .on('data', function(data) {\n    hasher.update(data);\n  })\n  .on('end', function() {\n    console.log('Hash value = ' + hasher.digest());\n  });\n```\n\n* Hash a file with a hash stream:\n\n```javascript\nvar HashStream = require('xxhash').Stream;\nvar fs = require('fs');\n\nvar hasher = new HashStream(0xCAFEBABE);\n\nfs.createReadStream('somefile')\n  .pipe(hasher)\n  .on('finish', function() {\n    console.log('Hash value = ' + hasher.read());\n  });\n```\n\n\nAPI\n===\n\nXXHash Static Methods\n---------------------\n\n* **hash**(\u003c _Buffer_ \u003edata, \u003c _mixed_ \u003eseed[, \u003c _mixed_ \u003eencbuf]) - _mixed_ - Performs a single/one-time 32-bit hash of `data` with the given `seed`. `seed` can be an unsigned integer or a Buffer containing (1 \u003c= n \u003c= 4) bytes to use for the seed. The resulting hash is returned. The format of the hash depends on the value of `encbuf`. If `encbuf` is a string and one of: `buffer`, `hex`, `base64`, or `binary`, then the hash value will be encoded in the appropriate format. If `encbuf` is a _Buffer_ of at least 4 bytes, then the hash value will be written to `encbuf` and `encbuf` will be returned. Otherwise, if `encbuf` is not supplied, then the hash will be an unsigned integer.\n\n* **hash64**(\u003c _Buffer_ \u003edata, \u003c _mixed_ \u003eseed[, \u003c _mixed_ \u003eencbuf]) - _mixed_ - Performs a single/one-time 64-bit hash of `data` with the given `seed`. `seed` can be an unsigned integer or a Buffer containing (1 \u003c= n \u003c= 8) bytes to use for the seed. The resulting hash is returned. The format of the hash depends on the value of `encbuf`. If `encbuf` is a string and one of: `buffer`, `hex`, `base64`, or `binary`, then the hash value will be encoded in the appropriate format. If `encbuf` is a _Buffer_ of at least 8 bytes, then the hash value will be written to `encbuf` and `encbuf` will be returned. The default value for `encbuf` is `'buffer'`.\n\n\nXXHash Static Properties\n------------------------\n\n* **Stream(\u003c _mixed_ \u003eseed[, \u003c _integer_ \u003ebits][, \u003c _mixed_ \u003eencbuf])** - _DuplexStream_ - A stream constructor that takes in the `seed` to use. Write data to the stream and when the stream ends, a `bits`-bit (32 or 64) hash value (format determined by `encbuf`) is available on the readable side. The values for `seed` and `encbuf` are described above in `hash()`.\n\n* **XXHash64(\u003c _mixed_ \u003eseed)** - This is the 64-bit Hash constructor. It is only needed if you want to use the old streaming interface (`update()`/`digest()`) instead of the streams2 interface described above.\n\n\nXXHash Methods\n--------------\n\n* **(constructor)**(\u003c _mixed_ \u003eseed) - Creates and returns a new 32-bit Hash instance with the given `seed`. The values for `seed` are described above in `hash()`.\n\n* **update**(\u003c _Buffer_ \u003edata) - _(void)_ - Update the hash using `data`.\n\n* **digest**([\u003c _mixed_ \u003eencbuf])  - _mixed_ - The values for `encbuf` and the resulting hash value format is described in `hash()`.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmscdex%2Fnode-xxhash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmscdex%2Fnode-xxhash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmscdex%2Fnode-xxhash/lists"}