https://github.com/ianlucas/cs2-lib
A TypeScript library for manipulating Counter-Strike 2 data
https://github.com/ianlucas/cs2-lib
counter-strike-2 cs2 typescript
Last synced: 3 months ago
JSON representation
A TypeScript library for manipulating Counter-Strike 2 data
- Host: GitHub
- URL: https://github.com/ianlucas/cs2-lib
- Owner: ianlucas
- License: mit
- Created: 2023-04-08T19:17:45.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-04-04T00:01:13.000Z (9 months ago)
- Last Synced: 2025-04-04T00:28:02.391Z (9 months ago)
- Topics: counter-strike-2, cs2, typescript
- Language: TypeScript
- Homepage: https://ianlucas.github.io/cs2-lib/
- Size: 1.57 GB
- Stars: 16
- Watchers: 2
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: License.txt
Awesome Lists containing this project
README
# cs2-lib
> A TypeScript library for manipulating Counter-Strike 2 data
This library contains items and data from Counter-Strike 2, including utility functions and classes for interacting with them using TypeScript.
## Install
```sh
npm install @ianlucas/cs2-lib
```
## Usage
```typescript
import { CS2Economy, CS2_ITEMS } from "@ianlucas/cs2-lib";
import { english } from "@ianlucas/cs2-lib/translations";
CS2Economy.use({
items: CS2_ITEMS,
language: english
});
const item = CS2Economy.getById(307);
item.name;
//=> "AWP | Dragon Lore"
```
## Download asset images
By default the library uses my CDN at `cdn.cstrike.app` for image URLs. If you need to self-host your content, you can find and download the latest images at [cs2-lib-assets repository](https://github.com/ianlucas/cs2-lib-assets). Make sure to point the assets base URL to your website:
```typescript
CS2Economy.use({
assetsBaseUrl: "https://your-website.com/assets",
items: CS2_ITEMS,
language: english
});
```