npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@shaunlwm/pickle.ts

v1.8.0

Published

Club Penguin Private Server client library

Readme

pickle.ts

Type-safe client library for Club Penguin Private Servers.

Built with TypeScript, Socket.IO, and msgpack. Supports multiple CPPS backends through an adapter pattern — ships with CPJourney and CPLegacy support.

Install

npm install @shaunlwm/pickle.ts

Quick Start

import { Client } from "pickle.ts"

const client = new Client("CPJourney")

const servers = await client.login({
  username: "myuser",
  password: "mypass",
})
// => [{ name: "Blizzard", population: 6 }, { name: "Sleet", population: 3 }, ...]

await client.connect(servers[0].name)

console.log(client.player?.username) // your penguin
console.log(client.room)             // current room id
console.log(client.users.size)       // penguins in room

client.walk(400, 300)
client.sendMessage("hello!")
client.joinRoom(100)

client.disconnect()

API

new Client(server, options?)

Creates a new client instance.

| Param | Type | Description | |---|---|---| | server | "CPJourney" \| "CPLegacy" | CPPS server identifier (strongly typed) | | options.debug | boolean \| LogFn | Enable debug logging. Pass true for console.log, or a custom function |

// default console.log
const client = new Client("CPJourney", { debug: true })

// custom logger
const client = new Client("CPJourney", {
  debug: (msg, ...args) => myLogger.info(msg, ...args)
})

client.login(options)

Authenticates and returns the server list with populations.

const servers = await client.login({
  username: "user",
  password: "pass",
})
// servers: ServerInfo[] = [{ name: string, population: number }]

Also supports token-based login:

const servers = await client.login({
  username: "user",
  token: "savedToken",
})

client.connect(serverName, options?)

Connects to a game server. Handles queue automatically if the server is full.

await client.connect("Blizzard")

// with queue monitoring
await client.connect("Blizzard", {
  onQueueUpdate: ({ position, queueLength }) => {
    console.log(`#${position} of ${queueLength}`)
  }
})

After connect() resolves, client.player, client.room, and client.users are populated.

State

| Property | Type | Description | |---|---|---| | client.player | PlayerData \| null | Your penguin's full data (coins, inventory, settings, etc.) | | client.room | number \| null | Current room ID | | client.users | Map<number, RoomUser> | All penguins in the current room, keyed by ID | | client.connected | boolean | Whether the client is connected to a game server |

client.users is automatically kept in sync — players are added/removed as they join/leave, positions and equipment update in real-time.

Actions

// Movement
client.walk(x, y)
client.joinRoom(roomId)
client.joinRoom(roomId, spawnX, spawnY)

// Chat
client.sendMessage("hello!")
client.sendEmote(1)          // wave
client.sendSafe(800)         // safe chat message id
client.snowball(x, y)

// Equipment
client.equipColor(1)
client.equipHead(1234)
client.equipFace(5678)
client.equipNeck(9012)
client.equipBody(3456)
client.equipHand(7890)
client.equipFeet(1234)
client.equipFlag(5678)
client.equipPhoto(9012)
client.addItem(itemId)

// Social
client.buddyRequest(userId)
client.buddyAccept(userId)
client.buddyReject(userId)
client.buddyRequestSeen(userId)
client.getBuddy(userId, "buddies")      // fetch buddy details
client.getBuddy(userId, "buddyRequests") // fetch request details
client.removeBuddy(userId)
client.addIgnore(userId)
client.removeIgnore(userId)
client.getPlayer(userId)
client.sendPostcard(userId, "62")  // send mail (costs coins)

// Stamps & Igloos
client.getStamps(userId)           // view stampbook
client.getIglooOpen(userId)        // check if igloo is open
client.joinIgloo(userId)           // enter igloo

// Animation
client.sendFrame(frameId)

// Utility
client.getMascots()
client.getAllSlots()
await client.sleep(2000)  // delay between actions
client.disconnect()

Events

All events are fully typed via ServerMessages.

client.on("send_message", ({ id, message }) => {
  const user = client.users.get(id)
  console.log(`${user?.username}: ${message}`)
})

client.on("add_player", ({ user }) => {
  console.log(`${user.username} joined the room`)
})

client.on("remove_player", ({ user }) => {
  console.log(`Player ${user} left`)
})

client.on("send_position", ({ id, x, y }) => {
  console.log(`Player ${id} moved to (${x}, ${y})`)
})

client.on("update_player", ({ id, item, slot }) => {
  console.log(`Player ${id} equipped ${item} on ${slot}`)
})

client.on("send_emote", ({ id, emote }) => {
  console.log(`Player ${id} emote ${emote}`)
})

client.on("send_frame", ({ id, frame }) => {
  console.log(`Player ${id} frame ${frame}`)
})

client.on("join_room", ({ room, users }) => {
  console.log(`Joined room ${room} with ${users.length} penguins`)
})

client.on("wait_queue_update", ({ position, queueLength }) => {
  console.log(`Queue: #${position}/${queueLength}`)
})

client.on("kick", ({ reason }) => {
  console.log(`Kicked: ${reason}`)
})

client.on("close_with_error", ({ error }) => {
  console.log(`Disconnected: ${error}`)
})

client.on("buddy_accept", ({ id, username, online }) => {
  console.log(`${username} accepted your buddy request (online: ${online})`)
})

client.on("stamps_result", ({ stamps, username }) => {
  console.log(`${username} has ${stamps.length} stamps`)
})

client.on("disconnect", () => {
  console.log("Connection lost")
})

The kick event fires on CPLegacy, close_with_error on CPJourney — both indicate the server forcibly disconnected the client (e.g. duplicate login). State is automatically cleaned up in both cases.

Types

All types are exported for external use:

import type {
  PlayerData,       // full player data (coins, inventory, settings, buddies, etc.)
  RoomUser,         // player in a room (appearance, position, state)
  PlayerAppearance, // equipment slots (color, head, face, body, etc.)
  PlayerSettings,   // game settings
  Buddy,            // buddy list entry
  Mascot,           // mascot data
  ServerInfo,       // server name + population
  LoginOptions,     // username + password login
  TokenLoginOptions,// username + token login
  LoginResult,      // login response (servers, key, username)
  QueueUpdate,      // queue position update
  ClientMessages,   // all client -> server message types
  ServerMessages,   // all server -> client message types
} from "pickle.ts"

Custom Adapters

To support a different CPPS, extend BaseAdapter:

import { BaseAdapter } from "pickle.ts"

export class MyServerAdapter extends BaseAdapter {
  readonly id = "MyServer"

  async login(options) { /* your login flow */ }
  async connect(serverName, loginResult, options?) { /* your connect flow */ }
  send(action, args) { /* your packet format */ }
  disconnect() { /* cleanup */ }

  // override any game method if the server uses different packets
  joinRoom(room, x, y) {
    this.send("custom_join", { roomId: room })
  }
}

License

MIT