Skip to content

Commit 1035dce

Browse files
committed
docs: clarify how to self-host benchmark data
Move self-hosting instructions into their own section with a concrete benchmarksURL example, so users aren't left guessing how to wire the extracted tarball up to getGPUTier.
1 parent 2e330b2 commit 1035dce

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ Classifies GPUs based on their 3D rendering benchmark score allowing the develop
2121
2222
## Installation
2323
24-
By default we use the [UNPKG](https://unpkg.com) CDN to host the benchmark data. If you would like to serve the benchmark data yourself download the required benchmarking data from [benchmarks.tar.gz](https://github.com/pmndrs/detect-gpu/raw/master/benchmarks.tar.gz) and serve it from a public directory.
25-
2624
```sh
2725
pnpm add @pmndrs/detect-gpu
2826
```
@@ -35,6 +33,21 @@ npm install @pmndrs/detect-gpu
3533
yarn add @pmndrs/detect-gpu
3634
```
3735

36+
## Self-hosting benchmark data
37+
38+
By default benchmark data is loaded from the [UNPKG](https://unpkg.com) CDN (`https://unpkg.com/@pmndrs/detect-gpu@{version}/dist/benchmarks`). To serve it yourself (e.g. for offline environments, strict CSP, or to avoid a third-party CDN):
39+
40+
1. Download [benchmarks.tar.gz](https://github.com/pmndrs/detect-gpu/raw/master/benchmarks.tar.gz) and extract it into a publicly served directory — for example `public/benchmarks/` in your app.
41+
2. Point `getGPUTier` at that URL via the `benchmarksURL` option:
42+
43+
```ts
44+
const gpuTier = await getGPUTier({
45+
benchmarksURL: '/benchmarks',
46+
});
47+
```
48+
49+
The directory must be served at the exact URL passed in — `detect-gpu` appends filenames like `/benchmarks-d-*.json` to it when fetching.
50+
3851
## Usage
3952

4053
```ts

0 commit comments

Comments
 (0)