@bugsplat/js-api-client

中文文档
15.8.0发布于 2026/10/05MITTypeScriptESM + CJS近 30 天下载 4334

JS client for consuming the BugSplat API

原始使用文档
文档目录8 节
  1. Crash and error reporting built for busy developers.
  2. 👋 Introduction
  3. 🏗 Installation
  4. ⚙️ Configuration
  5. Node.js
  6. Web Browser
  7. ⌨️ Usage
  8. 🧑‍💻 Contributing

bugsplat-github-banner-basic-outline

BugSplat

Crash and error reporting built for busy developers.

👋 Introduction

@bugsplat/js-api-client is a set of JavaScript client libraries for consuming the BugSplat API. This package is compatible in both browser and node environments as it provides ESM and CommonJS builds for each environment respectively. Additionally this package is implemented in TypeScript and the distributed builds include definition files and source maps.

🏗 Installation

Install @bugsplat/js-api-client via npm. This package currently requires Node.js 18 or later.

npm i @bugsplat/js-api-client

If you need to use a version of Node.js that's older than 18, you can install @bugsplat/[email protected].

⚙️ Configuration

Import BugSplatApiClient and Environment from @bugsplat\js-api-client

import { BugSplatApiClient, Environment } from '@bugsplat/js-api-client';

Create an authenticated BugSplatApiClient following the steps below. Authentication is slightly different depending on if you are use @bugsplat/js-api-client in a Node.js or Web Browser environment. The method used to authenticate also depends on if you already have access to the user's email and password, or if you have to prompt for it at a later time.

The host value used to create a new instance of BugSplatApiClient is https://app.bugsplat.com for most scenarios. When using this library to upload a crash reports the host value will be https://{{database}}.bugsplat.com.

Node.js

The static factory function createAuthenticatedClientForNode can be used to return an authenticated instance of BugSplatApiClient in Node.js environments.

const bugsplat = await BugSplatApiClient.createAuthenticatedClientForNode(email, password, host);

If you need to authenticate at a later time, you can create an instance of BugSplatApiClient and call login manually.

const bugsplat = new BugSplatApiClient(host, Environment.Node);
await bugsplat.login(email, password);

Web Browser

The static factory function createAuthenticatedClientForWebBrowser can be used to return an authenticated instance of BugSplatApiClient.

const bugsplat = await BugSplatApiClient.createAuthenticatedClientForBrowser(email, password, host);

If you need to authenticate at a later time, you can create an instance of BugSplatApiClient and call login manually.

const bugsplat = new BugSplatApiClient(host, Environment.WebBrowser);
await bugsplat.login(email, password);

⌨️ Usage

Create an instance of CrashApiClient or any of the API clients and pass a reference to the BugSplatApiClient instance

const client = new CrashApiClient(bugsplat);

The API clients are built to automatically parse responses from BugSplat into objects that can be used by your application

const database = 'Fred';
const id = 100389;
const crash = await client.getCrashById(database, id);

for (const stackFrame of crash.thread.stackFrames) {
  console.log(stackFrame);
}

// StackFrame {
//     fileName: 'C:\\BugSplat\\samples\\myConsoleCrasher\\myConsoleCrasher.cpp',
//     functionName: 'myConsoleCrasher!MemoryException',
//     lineNumber: 150,
//     stackFrameLevel: 1,
//     arguments: [],
//     locals: []
// }
// StackFrame {
//     fileName: 'C:\\BugSplat\\samples\\myConsoleCrasher\\myConsoleCrasher.cpp',
//     functionName: 'myConsoleCrasher!wmain',
//     lineNumber: 84,
//     stackFrameLevel: 2,
//     arguments: [
//       { variable: 'int argc', value: '0n2' },
//       { variable: 'wchar_t ** argv', value: '0x0125ef20' }
//     ],
//     locals: [
//       { variable: 'int i', value: '0n1' },
//       { variable: 'int argc', value: '0n2' },
//       { variable: 'wchar_t ** argv', value: '0x0125ef20' }
//     ]
// }
// ...

🧑‍💻 Contributing

BugSplat ❤️s open source! If you feel that this package can be improved, please open an Issue. If you have an awesome new feature you'd like to implement, we'd love to merge your Pull Request. You can also send us an email, join us on Discord, or message us via the in-app chat on bugsplat.com.

版本与发布记录

@bugsplat/js-api-client 共发布 95 个版本,首次发布于 2021/06/02;过去 12 个月发布了 20 个版本。

版本发布日期距今
15.8.0latest2026/10/051 个月前
15.7.02026/08/272 个月前
15.6.02026/08/132 个月前
15.5.12026/08/073 个月前
15.5.02026/08/043 个月前
15.4.02026/07/283 个月前

关于 @bugsplat/js-api-client 的常见问题

@bugsplat/js-api-client 是什么?

JS client for consuming the BugSplat API

如何安装 @bugsplat/js-api-client?

在项目目录运行 npm install @bugsplat/js-api-client,或使用 pnpm add / yarn add / bun add。

@bugsplat/js-api-client 支持 TypeScript 吗?

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

@bugsplat/js-api-client 支持 ESM 还是 CommonJS?

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

@bugsplat/js-api-client 可以商用吗?

@bugsplat/js-api-client 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@bugsplat/js-api-client 的下载量有多少?

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

@bugsplat/js-api-client 还在维护吗?

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