Encode and decode Counter-Strike 2 inspect URLs with TypeScript. Read embedded links offline, create previews with skins and stickers, or resolve legacy inventory and market links through Steam.
Requires Node.js 22.12+.
npm install cs2-inspect-libimport { createInspectUrl, decodeMaskedUrl, WeaponType, WeaponPaints, type WeaponEconItem } from 'cs2-inspect-lib'
const item = {
defindex: WeaponType.AK_47,
paintindex: WeaponPaints.AK_47.CASE_HARDENED,
paintseed: 661,
paintwear: 0.15
} satisfies WeaponEconItem<WeaponType.AK_47>
const url = createInspectUrl(item)
const decoded = decodeMaskedUrl(url)
console.log(decoded.paintseed) // 661Embedded links do not need Steam credentials. Legacy S…A…D… and M…A…D… links require an initialized Steam client. See the Steam guide.
- Local inspect-link encoding and decoding, including nonzero XOR-mask tokens.
- Stickers, charms, variations, StatTrak fields and bigint item IDs.
- September 2026 protocol fields:
customnames,pet_food_expiration_dateandblobdata. The singularcustomnameAPI remains supported. - Validation, typed errors, paint lookup helpers and a CLI.
- Steam integration through
node-cs2, with request queuing and timeouts.
For examples and behavior details, see getting started, the API guide and protocol compatibility.
npx cs2inspect encode --weapon AK_47 --paint 44 --seed 661 --float 0.15
npx cs2inspect --helpnpm ci
npm run build
npm run lint
npm run check:weapon-data
npm test -- --runInBand
npm run docs:dev
npm run docs:build
npm run docs:previewDocumentation lives in docs/ as hand-written Markdown. npm run docs is an alias for the production site build. GitHub Actions checks the package and builds the site on pull requests; pushes to master or main deploy docs/.vitepress/dist to GitHub Pages at /cs2-inspect-lib/.
Weapon and paint enums come from pinned ByMykel API data. Run npm run generate:weapon-paints to fetch and regenerate both, or add -- --offline to use the checked-in snapshot. See the weapon data guide for naming, lookup helpers and the corrected default CT/T glove IDs.
Use npm for the CI lockfile. After dependency changes, also run bun install --lockfile-only to update the checked-in Bun lockfile.
TypeScript remains on 6.0.3 because the latest TypeScript ESLint packages and ts-jest do not support TypeScript 7 yet. Other direct dependencies target their latest stable releases. npm audit currently reports upstream findings in Steam's adm-zip dependency and the stable VitePress development toolchain; see the v5.0.0 changelog notes.
Tests run offline and do not verify live Steam authentication or Game Coordinator availability. Contributions should include regression tests for protocol changes and a successful documentation build.
Changelog · Report an issue · MIT license
Use cs2-inspect-lib/core for browser-safe embedded encoding/decoding, batch inspection,
structured diagnostics, game-aware validation, semantic comparison, and lossless wire
editing. Use cs2-inspect-lib/steam for authenticated APIs; existing root imports remain
compatible. See the item-tools guide
for API examples, snapshot provenance, cancellation semantics, and exact preservation guarantees.