You must already have a Soulseek account before using this module.
- File search
- File download
This stuff is not implemented (yet?), but I wait your PR!
- Chat
- Sharing (+ Upnp opened port)
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).
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
})
})
})
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 | [] |
Return client (see just here ⬇)
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 |
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
}
]
You can handle results with events
client.on('found') // any search result
client.on('found:${req}') // or only a specific request
Return buffered file, callback called when file is completely downloaded. (Stored in RAM)
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}} |
key | value |
---|---|
buffer | Complete buffer of file |
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
key | required | value | default | note |
---|---|---|---|---|
file | true | File sent when searched |
Readable stream
Use env variables for tests
DEBUG=slsk:*
to display debug messagesSLSK_USER=MyUsername
SLSK_PASS=MyPassword
ftp://ftp.tu-clausthal.de/pub/mirror/ftp.gwdg.de/gnu/ftp/savannah/files/mldonkey/docs/Soulseek/soulseek_protocol.html