-
-
Notifications
You must be signed in to change notification settings - Fork 96
API Reference
Complete API documentation for steamworks.js.
Note: Some Steamworks features (notably legacy P2P networking) are deprecated upstream by Valve in favor of Steam Networking Sockets. Where applicable, this is called out below.
- Initialization
- Local Player
- Achievements
- Stats
- Cloud
- Friends
- Apps
- Utils
- Overlay
- Input
- UGC / Workshop
- Networking (Legacy P2P)
- Matchmaking
- Screenshots
- DLC
- Type Definitions
Initializes the Steamworks API. If appId is omitted, place a steam_appid.txt with the ID in your app directory.
Throws if Steam isn't running or the API fails to init.
const steamworks = require('steamworks.js');
const client = steamworks.init(480);Enables the Steam Overlay for Electron. Call after creating your BrowserWindow.
const { BrowserWindow } = require('electron');
const steamworks = require('steamworks.js');
const win = new BrowserWindow(/* ... */);
steamworks.electronEnableSteamOverlay();Steam persona name of the current user.
Returns { steamId64: string, accountId: number }.
Steam account level.
Current players for this app (as reported by Steam).
Unlocks an achievement. Call client.stats.storeStats() to commit.
Returns whether an achievement is unlocked.
Locks an achievement (testing).
Clears all achievements (testing).
List of achievement API names for this app.
Returns { name: string, description: string, hidden: boolean, achieved: boolean }.
Commits pending stat/achievement changes to Steam.
Resets stats (and optionally achievements) — testing only.
client.friends.setRichPresence(key: string, value: string): boolean
client.friends.clearRichPresence(): voidReturns { state: boolean, active: boolean }.
Returns { folder: string, sizeOnDisk: number }.
Upstream Steamworks marks ISteamNetworking P2P as deprecated — prefer Networking Sockets where available.
client.networking.sendP2PPacket(id: SteamId, data: Buffer, sendType: number, channel: number): boolean
Returns { data: Buffer, steamId: SteamId }.
Returns { appId: number, available: boolean, name: string }.
{
steamId64: string; // 64-bit ID as string
accountId: number; // 32-bit account ID
}Contains the namespaces: localplayer, achievement, stats, cloud, friends, apps, utils, overlay, input, ugc, networking, matchmaking, screenshots, dlc.
- See the repository README for init and overlay details.
- For a complete, up-to-date function list, check
client.d.tsin the repo.