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

slsk-client

v2.0.2

Published

Soulseek NodeJS client

Readme

Soulseek NodeJS client

slsk-client logo

CI GitHub stars

A modern NodeJS client for the Soulseek peer-to-peer network, written in TypeScript with a fully promise-based (async/await) API and complete TypeScript type declarations.

Features

  • File Search: Search the distributed Soulseek network with exclusion keywords and attribute filters.
  • File Downloads: Reliable downloads supporting streaming, queueing, automatic retries, and resume on interrupted transfers.
  • File Sharing: Share files from the local filesystem (fsShareProvider), memory (memoryShareProvider), or custom providers (e.g. S3 / database).
  • Upload Queue: Serve shared files with configurable slots and per-peer queue limits.
  • Private Messaging: Send and receive private messages through the Soulseek server.
  • Self-Documented: Comprehensive TypeScript types and JSDoc annotations for all options, methods, and events right in your editor.

Installation

npm install slsk-client

Getting Started

You must already have a Soulseek account before using this module.

import { SlskClient, FileAttribute } from 'slsk-client'

const client = new SlskClient()
await client.login('myUsername', 'myPassword')

// Search for files
const results = await client.search({
  req: 'random track',
  timeout: 4000
})

// Filter or sort results (e.g., 320kbps MP3s)
const bestResult = results
  .filter(r => r.attribs[FileAttribute.Bitrate] === 320)
  .sort((a, b) => (b.speed ?? 0) - (a.speed ?? 0))[0]

// Download
if (bestResult) {
  const download = client.download({
    ...bestResult,
    path: '/path/to/save/song.mp3'
  })

  download.on('progress', ({ progress }) => {
    console.log(`Progress: ${Math.round((progress ?? 0) * 100)}%`)
  })

  const { path, buffer } = await download
  console.log(`Saved to ${path}`)
}

Usage

Downloading

The download() method returns a Download instance that can be awaited as a Promise or used as a stream:

// Follow transfer events
const download = client.download({ ...result, path: '/tmp/song.mp3' })

download.on('status', status => console.log('Status:', status)) // queued, connected, downloading, complete
download.on('queue', place => console.log(`Queue position: ${place}`))
download.on('progress', ({ progress }) => console.log(`${Math.round((progress ?? 0) * 100)}%`))

const res = await download

// Or stream directly (e.g., pipe to an HTTP response or custom write stream)
client.download(result).stream.pipe(writableStream)

// Resuming a partial download
const offset = (await fs.promises.stat(partialPath)).size
await client.download({ ...result, path: partialPath, offset })

// Cancelling with AbortSignal
await client.download({ ...result, signal: AbortSignal.timeout(30000) })

Sharing and Uploading

Files can be shared using built-in or custom share providers:

import { SlskClient, fsShareProvider, memoryShareProvider } from 'slsk-client'

const client = new SlskClient({
  shares: [
    fsShareProvider({ folders: ['/home/me/music'], root: 'music' }),
    memoryShareProvider({ 'jingles\\intro.mp3': introBuffer })
  ],
  // Enable uploading shared files to requesting peers
  uploads: {
    slots: 2,        // Concurrent upload slots
    queueLimit: 50   // Max queued files per peer
  }
})

await client.login('myUsername', 'myPassword')

// Track upload activity
client.on('upload-queued', ({ user, file, place }) => console.log(`${user} queued ${file} at ${place}`))
client.on('upload-progress', ({ user, file, progress }) => console.log(`${file}: ${Math.round(progress * 100)}%`))
client.on('upload-complete', ({ user, file }) => console.log(`Finished uploading ${file} to ${user}`))

Private Messages

// Receive messages
client.on('private-message', ({ user, message, sentAt, pending }) => {
  console.log(`[${sentAt.toISOString()}] ${user}: ${message}`)
  client.sendPrivateMessage(user, 'Thanks for your message!')
})

// Send a message
client.sendPrivateMessage('anotherUser', 'Hello!')

Client Events

SlskClient extends EventEmitter with strongly typed events:

client.on('found', result => console.log('Found:', result.file))
client.on('server-error', err => console.error('Server error:', err))
client.on('server-disconnect', ({ reconnecting }) => console.log('Disconnected, reconnecting:', reconnecting))
client.on('server-reconnect', () => console.log('Reconnected to Soulseek'))

TypeScript Documentation

This library is written natively in TypeScript. All configuration options (SlskClientOptions, DownloadOptions, SearchOptions, UploadOptions), return types (SearchResult, DownloadResult, UserInfo), and event payloads are fully typed with detailed JSDoc descriptions.

Use your IDE's hover tooltips and autocomplete (e.g., in VS Code or WebStorm) to explore available options, methods, and event payloads without needing external reference tables.

Development

npm install
npm test              # Run type checks and unit tests
npm run build         # Build TypeScript to dist/
npm run coverage      # Run unit tests with coverage
npm run test:integration  # Integration tests against real Soulseek network (requires SLSK_USER & SLSK_PASS)

Debugging

The library uses the debug package. Set the DEBUG environment variable to inspect internal logs:

DEBUG=slsk:* node app.js        # Log everything
DEBUG=slsk:server node app.js   # Server connection logs
DEBUG=slsk:peer:* node app.js   # Peer connection logs
DEBUG=slsk:download node app.js # Download logs
DEBUG=slsk:upload node app.js   # Upload logs

Protocol Compliance & Documentation

License

MIT