npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@gby/uniqueid

v1.2.0

Published

uniqueid 无任何依赖,提供了获取唯一标识相关的工具,比如:UUID、UCID、Fingerprint、浏览器指纹、唯一标识符 等等

Downloads

15

Readme

目录

内容

1. 简介

uniqueid 无任何依赖,提供了获取唯一标识相关的工具,比如:UUID、UCID、Fingerprint、浏览器指纹、唯一标识符 等等。

之所以要重复造这个轮子,是因为网上找的其它浏览器指纹库会在浏览器启动前期每次刷新会得到不同的指纹。

具有以下功能:

  • 获取浏览器指纹:即使在浏览器启动前期也非常稳定;之所以要重复造这个轮子,是因为网上找的其它浏览器指纹库会在浏览器启动前期每次刷新会得到不同的指纹。
  • 获取 UUID、UCID
  • 获取唯一字符串
  • 等等

详情请看:

如果您在使用的过程中遇到了问题,或者有好的建议和想法,您都可以通过以下方式联系我,期待与您的交流:

2. 安装方式

目前,安装方式有以下几种:

2.1. 方式1:通过 npm 安装

npm install --save-prod @gby/uniqueid

2.2. 方式2:直接下载原代码

您可直接从项目的 发行地址 下载 源码 或 构建后包文件;

您可以直接把 源码 或 构建后 的包拷贝到您的项目中去;然后使用如下代码在您的项目中引入 uniqueid

import { getUUID,getUCID } from "path/to/package/uniqueid";

2.3. 方式3:通过<script>标签引入

您可直接从项目的 发行地址 中下载以 .iife.js 作为缀的文件,然后使用如下代码引用 和 使用 uniqueid:

  1. 引用 uniqueid

    <script src="path/to/package/uniqueid.iife.js"></script>
  2. 使用全局的 uniqueid

    <script>
    // 使用全局的 uniqueid
        const uuid = uniqueid.getUUID();
    </script>

3. API接口

  • setKeyPrefix(keyPrefix:string):设置 用于存储 id 的 key 的前缀
  • getUUID():string: 获取 UUID 通用唯一识别码,用于标识浏览器,对于不同电脑实体的不同浏览器 会有不同的值
  • setUUID(id:string):设置 UUID
  • getUCID():string:获取 UCID,如果不重置,则对于每个浏览器中的同一个域名,每次获取的值都一样
  • setUCID(id:string):设置 UCID
  • createUniqueIdentifier():string:生成唯一的标识符,每次调用生成的都不一样
  • getCanvasFingerprint():string:获取浏览器的Canvas指纹,用来标识设备上的浏览器,理论上,对于 不同计算机实体的不同浏览器会生成不同的指纹标识
  • murmurhash3_32_gc(key:string):number:MurmurHash3 算法

有您的支持,我会在开源的道路上,越走越远

赞赏码