https://github.com/ragingwind/eddystone-uid
Eddystone UID generator
https://github.com/ragingwind/eddystone-uid
Last synced: 10 months ago
JSON representation
Eddystone UID generator
- Host: GitHub
- URL: https://github.com/ragingwind/eddystone-uid
- Owner: ragingwind
- License: mit
- Created: 2015-07-31T01:11:54.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2016-11-24T00:04:40.000Z (over 9 years ago)
- Last Synced: 2025-04-22T07:50:37.837Z (about 1 year ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 8
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# eddystone-uid
> Eddystone UID convertor
## Install
```
$ npm install --save eddystone-uid
```
## Usage
```js
var eddystoneUid = require('eddystone-uid');
eddystoneUid.toBeaconId('123456');
//=> 313233343536
eddystoneUid.toBeaconId('app-id');
//=> 6170702d6964
eddystoneUid.toNamespace('https://goo.gl/r8iJqW');
//=> randomly
eddystoneUid.toNamespace('8b0ca750-e7a7-4e14-bd99-095477cb3e77');
//=> 8b0ca750095477cb3e77
```
## API
### toBeaconId(src, encoding)
#### src
String to Beacon/Instance Id
#### encoding
Encoding type of Beacon Id, It returns String as encoding in `hex` other is `buf` to return raw Buffer
### toNamespace(src)
#### src
Using FQDN or UUID, which will be hashed and then truncated. Please refer [more info](https://github.com/ragingwind/eddystone/tree/master/eddystone-uid#truncated-hash-of-fqdn)
## License
MIT © [ragingwind](http://ragingwind.me)