BugSpla
为繁忙的开发者构建了崩溃和错误报告 .
精灵
用于解析 ELF/ SELF 文件的微小工具 。 在Node.js和浏览器中都工作.
使用量
- 安装此软件包
npm i @bugsplat/elfy
- 创建实例
ElfFile通过一个DataSource. 库提供多个内置数据源:
浏览器( 有文件输入)
import { ElfFile, BlobDataSource } from '@bugsplat/elfy';
// From a file input element
const file = document.getElementById('file-input').files[0];
const dataSource = new BlobDataSource(file);
const elfFile = new ElfFile(dataSource);
浏览器( 有获取)
import { ElfFile, BlobDataSource } from '@bugsplat/elfy';
const response = await fetch('https://example.com/file.elf');
const blob = await response.blob();
const dataSource = new BlobDataSource(blob);
const elfFile = new ElfFile(dataSource);
节点.js(大文件有文件手持)
import { open } from 'node:fs/promises';
import { ElfFile, DataSource } from '@bugsplat/elfy';
// Create a custom DataSource for Node.js file handles
class FileHandleDataSource implements DataSource {
constructor(private fileHandle) {}
async read(offset: number, length: number): Promise<Uint8Array> {
const buffer = new Uint8Array(length);
const { bytesRead } = await this.fileHandle.read(buffer, 0, length, offset);
return buffer.slice(0, bytesRead);
}
}
const fileHandle = await open('path/to/elf/file', 'r');
try {
const dataSource = new FileHandleDataSource(fileHandle);
const elfFile = new ElfFile(dataSource);
// ... use elfFile
} finally {
await fileHandle.close();
}
记忆缓冲器
import { ElfFile, BufferDataSource } from '@bugsplat/elfy';
// From an ArrayBuffer or Uint8Array already in memory
const dataSource = new BufferDataSource(arrayBuffer);
const elfFile = new ElfFile(dataSource);
- 使用
readSection。如果该部分不存在,则该方法将投出.
const contents: Uint8Array = await elfFile.readSection('.note.gnu.build-id');
- 您也可以使用
tryReadSection。 。 。 .
const { success, section } = await elfFile.tryReadSection('.note.gnu.build-id');
数据来源
图书馆使用 DataSource 从任意来源获取抽象读取字节的界面 :
interface DataSource {
read(offset: number, length: number): Promise<Uint8Array>;
}
内建实施:
BlobDataSource- 对于浏览器Blob编号 :File对象。 只读取请求的字节Blob.slice()。 。 。 .BufferDataSource- 为了记忆Uint8Array或者说ArrayBuffer数据.
您可以为其它来源创建自定义执行( 如: Node.js) FileHandle, HTTP 范围请求等).
关于
BugSpla 是一个支持游戏引擎的软件崩溃和错误报告服务,例如 不真实的引擎,并支持诸如 游戏Station, (中文(简体) ), Xbox 选项 财务报告和审定财务报表 还有更多. BugSplatz 自动捕捉到堆栈痕迹等关键诊断数据,日志文件等运行时信息. BugSplat还提供自动事件通知,一个方便的仪表板来监测趋势并优先进行工程工作,并与流行开发工具相融合以最大限度地提高生产率并运送更盈利的软件.
