1.1.0 • Published 5 years ago

slsk-client v1.1.0

Weekly downloads
9
License
MIT
Repository
github
Last release
5 years ago

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
keyrequiredvaluedefaultnote
usertrueYour username
passtrueYour password
hostchoose a different host for Slsk serverserver.slsknet.org
portchoose a different port2242
incomingPortPort used for incoming connection2234
sharedFoldersFolders to be shared[]
callback

Return client (see just here ⬇)

client

search

argument
keyrequiredvaluedefaultnote
reqtrueSent to slsk server/peers to search file, use space to add keyword
timeoutSlsk doesn't sent when search is finished. We ignore request after this time4000
callback
keyvaluenote
userPeer name of slsk
fileFull path of peer file
sizeSize of file
slotsAvailable slotstrue if peer have enough slots to get file immediately
bitrateBitrate of current fileCan be undefined if not sent by client
speedSpeed of peerProvided 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
keyrequiredvaluedefaultnote
filetrueFile sent when searched
pathComplete path where file will be stored (if you want read it later)/tmp/slsk/{{originalName}}
callback
keyvalue
bufferComplete 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
keyrequiredvaluedefaultnote
filetrueFile 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

1.1.0

5 years ago

1.0.13

5 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago