Giter VIP home page Giter VIP logo

slsk-client's Introduction

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

Soulseek Protocol Documentation

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

https://nicotine-plus.org/doc/SLSKPROTOCOL.html

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

slsk-client's People

Contributors

ndr-brt avatar f-hj avatar dependabot[bot] avatar slook avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.