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 🙏

© 2024 – Pkg Stats / Ryan Hefner

slsk-client

v1.1.0

Published

Soulseek NodeJS client

Downloads

87

Readme

Soulseek NodeJS client

Build Status JavaScript Style Guide GitHub stars

Before starting

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

Implemented

  • File search
  • File download

Not implemented

This stuff is not implemented (yet?), but I wait your PR!

  • Chat
  • Sharing (+ Upnp opened port)

⚠ Infos

You must choose file with slots: true, or you'll wait a long time before downloading it.

I advise you to sort files by speed and select the best one (OK, speed is sent by client and can be fake, but the big majority is real).

Getting started

const slsk = require('slsk-client')
slsk.connect({
  user: 'username',
  pass: 'password'
}, (err, client) => {
  client.search({
    req: 'random',
    timeout: 2000
  }, (err, res) => {
    if (err) return console.log(err)
    res = [
      {
        user: 'poulet',
        file: '@@poulet-files/random.mp3',
        size: 6437362,
        slots: true,
        bitrate: 320,
        speed: 1251293
      }
    ]
    client.download({
      file: res[0],
      path: __dirname + '/random.mp3'
    }, (err, data) => {
      //can res.send(data.buffer) if you use express
    })
  })
})

API

slsk

connect

argument

| key | required | value | default | note | |-----|----------|-------|---------|------| |user| true |Your username| |pass| true| Your password| |host||choose a different host for Slsk server|server.slsknet.org| |port||choose a different port|2242| |incomingPort||Port used for incoming connection|2234| |sharedFolders||Folders to be shared|[]|

callback

Return client (see just here ⬇)

client

search

argument

| key | required | value | default | note | |-----|----------|-------|---------|------| |req|true|Sent to slsk server/peers to search file, use space to add keyword| |timeout||Slsk doesn't sent when search is finished. We ignore request after this time|4000|

callback

|key | value | note | |-----|-------|------| |user|Peer name of slsk| |file|Full path of peer file| |size|Size of file| |slots|Available slots|true if peer have enough slots to get file immediately| |bitrate|Bitrate of current file|Can be undefined if not sent by client| |speed|Speed of peer|Provided by peer, don't know what is it exactly|

List of files

[
  {
    "user": "jambon",
    "file": "@@jambon-slsk/myfile.m4a",
    "slots": true,
    "speed": 32
  }
]
events

You can handle results with events

client.on('found') // any search result
client.on('found:${req}') // or only a specific request

download

Return buffered file, callback called when file is completely downloaded. (Stored in RAM)

argument

| key | required | value | default | note | |-----|----------|-------|---------|------| |file|true|File sent when searched| |path||Complete path where file will be stored (if you want read it later)|/tmp/slsk/{{originalName}}|

callback

| key | value | |-----|-------| |buffer|Complete buffer of file|

downloadStream

WARNING: please report any issue with this function Return streamed file, wait for parts to be downloaded, can be used for HTTP 206 (partial content) for example

argument

| key | required | value | default | note | |-----|----------|-------|---------|------| |file|true|File sent when searched|

callback

Readable stream

Tests

Use env variables for tests

  • DEBUG=slsk:* to display debug messages
  • SLSK_USER=MyUsername
  • SLSK_PASS=MyPassword

Sources

ftp://ftp.tu-clausthal.de/pub/mirror/ftp.gwdg.de/gnu/ftp/savannah/files/mldonkey/docs/Soulseek/soulseek_protocol.html

https://www.museek-plus.org/wiki/SoulseekProtocol

https://github.com/Nicotine-Plus/nicotine-plus