@denniskrol/device-profiles

中文文档
1.20261111.0发布于 2026/11/11UnlicenseTypeScriptESM + CJS零依赖构建来源已验证近 30 天下载 5018

每日更新浏览器设备配置

中文使用文档
文档目录9 节
  1. 安装
  2. 基本用途
  3. 已过滤随机
  4. 静态助手
  5. 配置示例
  6. 过滤规则
  7. 加权选择
  8. JSON 访问
  9. 许可证

设备配置文件

npm downloads license node

每日更新有加权随机选择的浏览器/设备配置 。 可用于现实的客户端指纹洗刷,测试,负载生成.

数据来自一个网站, 大约65%的移动流量和35%的桌面流量 浏览器配置器 获取数据.

灵感来自 用户代理 这似乎不再更新 缺乏一些我需要的数据.

安装

npm install @denniskrol/device-profiles

基本用途

import { DeviceProfiles } from '@denniskrol/device-profiles';

// Get a weighted random profile
const profile = new DeviceProfiles();
console.log(profile.userAgent, profile.deviceType);

已过滤随机

// Only mobile devices
const mobile = new DeviceProfiles({ deviceType: 'mobile' });

// Regex match browser name
const safari = new DeviceProfiles({ browser: /Safari/ });

// Inclusion list (e.g. mobile OR tablet)
const touch = new DeviceProfiles({ deviceType: ['mobile', 'tablet'] });

// Function predicate (custom logic)
const chromeWithUAData = new DeviceProfiles(profile =>
  profile.userAgent.includes('Chrome') && !!profile.userAgentData
);

// Using static random with predicate
const randomChrome = DeviceProfiles.random(profile =>
  /Chrome/.test(profile.userAgent) && profile.deviceType === 'desktop'
);

静态助手

import { DeviceProfiles } from '@denniskrol/device-profiles';

// Get array of all profiles
const all = DeviceProfiles.all();

// Get random with filter without instantiating
const randomDesktop = DeviceProfiles.random({ deviceType: 'desktop' });

配置示例

{
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36",
  "platform": "Win32",
  "deviceMemory": 8,
  "hardwareConcurrency": 8,
  "vendor": "Google Inc.",
  "screenHeight": 720,
  "screenWidth": 1280,
  "viewportHeight": 568,
  "viewportWidth": 1251,
  "devicePixelRatio": 1.5,
  "webglRenderer": "ANGLE (Intel, Intel(R) UHD Graphics (0x00009B41) Direct3D11 vs_5_0 ps_5_0, D3D11)",
  "webglVendor": "Google Inc. (Intel)",
  "webGpuArchitecture": "gen-9",
  "webGpuVendor": "intel",
  "storageQuota": {
    "quota": 113282066841,
    "usage": 0,
    "available": 113282066841
  },
  "jsHeapSizeLimit": 2248146944,
  "fonts": [
    "Aldhabi",
    "Bahnschrift",
    "Cambria Math",
    "Gadugi",
    "HoloLens MDL2 Assets",
    "Ink Free",
    "Javanese Text",
    "Leelawadee UI",
    "Lucida Console",
    "MS Outlook",
    "Myanmar Text",
    "Nirmala UI",
    "Segoe MDL2 Assets",
    "Segoe UI Emoji"
  ],
  "userAgentData": {
    "architecture": "x86",
    "bitness": "64",
    "brands": [
      {
        "brand": "Chromium",
        "version": "142"
      },
      {
        "brand": "Google Chrome",
        "version": "142"
      },
      {
        "brand": "Not_A Brand",
        "version": "99"
      }
    ],
    "fullVersionList": [
      {
        "brand": "Chromium",
        "version": "142.0.7444.134"
      },
      {
        "brand": "Google Chrome",
        "version": "142.0.7444.134"
      },
      {
        "brand": "Not_A Brand",
        "version": "99.0.0.0"
      }
    ],
    "mobile": false,
    "model": null,
    "platform": "Windows",
    "platformVersion": "10.0.0",
    "uaFullVersion": "142.0.7444.134"
  },
  "weight":26,
  "deviceType":"desktop",
  "browser":"Chrome",
  "osName":"Windows"
}

过滤规则

  • 初级平等(deviceType: 'mobile'(中文(简体) )
  • 包含列表( deviceType : ['mobile','tablet'](中文(简体) )
  • RegExp 匹配( 浏览器 : /Safari/(中文(简体) )
  • 完全自定义逻辑的函数上游( profile QX布尔)

加权选择

每个剖面图都有重量. 随机选择与重量成正比.

JSON 访问

您也可以导入原始 JSON :

import profilesJson from '@denniskrol/device-profiles/deviceprofiles.json';
console.log(profilesJson.length);

许可证

取消许可证

版本与发布记录

@denniskrol/device-profiles 共发布 353 个版本,首次发布于 2025/11/12;过去 12 个月发布了 353 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.20261111.0latest2026/11/11今天
1.20261110.02026/11/101 天前
1.20261109.02026/11/092 天前
1.20261108.02026/11/083 天前
1.20261107.02026/11/074 天前
1.20261106.02026/11/065 天前

关于 @denniskrol/device-profiles 的常见问题

@denniskrol/device-profiles 是什么?

每日更新浏览器设备配置

如何安装 @denniskrol/device-profiles?

在项目目录运行 npm install @denniskrol/device-profiles,或使用 pnpm add / yarn add / bun add。

@denniskrol/device-profiles 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@denniskrol/device-profiles 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@denniskrol/device-profiles 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@denniskrol/device-profiles 可以商用吗?

@denniskrol/device-profiles 使用 Unlicense 许可。作者将代码贡献到公共领域,可不受限制地使用。以上为概括,不构成法律意见,请以许可原文为准。

@denniskrol/device-profiles 的下载量有多少?

根据 npm 官方下载统计,@denniskrol/device-profiles 在 2026/10/12 – 2026/11/10 这 30 天内被下载 5,018 次,日均约 167 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@denniskrol/device-profiles 还在维护吗?

最新版本 1.20261111.0 发布于 2026/11/11(今天);至今共发布 353 个版本,其中过去 12 个月发布了 353 个;首次发布于 2025/11/12。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。