1.0.6 • Published 2 years ago

cytrus v1.0.6

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Cytrus

Cytrus allows you to watch available games and assets updates on the Ankama Launcher. It also allows to download them.

Cytrus is available through a CLI and Class usable in your own code

Table of contents

Installation

You can install the cytrus package with npm

npm i --save cytrus

If you want to use the cli everywhere you can add the -g option

CLI

You can follow the instruction of the help command of the cli

cytrus --help
cytrus [command] --help

Cytrus

Watch a cytrus.json file

Kind: global class
Emits: assets:update, release:update

new Cytrus(saveFolder)

Constructor of the Cytrus class

ParamTypeDescription
saveFolderStringfolder of where to save the last data of the remote cytrus.json file to not trigger at each cycle

cytrus.watch(interval)

Watch remote cytrus.json file

Kind: instance method of Cytrus

ParamTypeDescription
intervalNumberinterval in ms

cytrus.unwatch()

Remove the watcher of the remote cytrus.json file

Kind: instance method of Cytrus

"assets:update"

Assets update event

Kind: event emitted by Cytrus
Properties

NameTypeDescription
gameStringGame name
releaseNameStringRelease name of the asset updated (ex: main/beta ...)
hashString | undefinedNew hash of the asset (undefined if deleted)

"release:update"

Release update event

Kind: event emitted by Cytrus
Properties

NameTypeDescription
gameStringGame name
platformStringPlatform of the release (ex: windows, darwin, linux ...)
releaseNameStringRelease name of the release updated (ex: main/beta ...)
versionString | undefinedNew hash of the release (undefined if deleted)

Exemple

const { Cytrus } = require('cytrus');
const cytrus = new Cytrus();

cytrus.on('assets:update', ({ game, releaseName, hash }) => {
  // an update of assets is available
});
cytrus.on('release:update', ({ game, releaseName, platform, version }) => {
  // an update of game is available
});

cytrus.watch(60000); // 60 000 = 60 sec

ReleaseDownloader

Download a release

Kind: global class
Emits: start, progress
Properties

NameTypeDescription
nbFilesDownloadedNumberNumber of files already downloaded
nbFilesToDownloadNumberNumber of files to update
filesToUpdateArray.<File>List of file needed to be updated
filesInDlArray.<String>List of filenames downloading

new ReleaseDownloader(game, platform, releaseName, version, dest, options)

ParamTypeDescription
gameStringName of the game (ex: dofus)
platformStringPlatform of the game (ex: windows/linux/darwin)
releaseNameStringRelease of the game (ex: main/beta/...)
versionStringVersion number (ex: 5.0_2.64.9.16)
destStringDestination folder
optionsObjectOptions of the Downloader (see each fields default)
options.ignoredFragmentsArray.<String>Fragments ignored (ex: 'win32' for dofus)
options.maxConcurrentDlNumberMaximum concurrent download (default: 10)

releaseDownloader.run() ⇒ Promise.<Array.<String>>

Run the update (download files...) The update is finished after it resolve

Kind: instance method of ReleaseDownloader
Returns: Promise.<Array.<String>> - List of filenames being download

"start"

Starting download event

Kind: event emitted by ReleaseDownloader
Properties

NameTypeDescription
totalNumberTotal number of files to dl

"progress"

Progress download event

Kind: event emitted by ReleaseDownloader
Properties

NameTypeDescription
nbFilesDownloadedNumberHow many files are already downloaded
filesDownloadingArray.<String>List of filenames downloading

Exemple

const { ReleaseDownloader } = require('cytrus');
const update = new ReleaseDownloader(game, platform, release, version, dest);

update.on('start', ({ total }) => {
  // total {Number} = total number of files needed to be dl
});

update.on('progress', ({ nbFilesDownloaded, filesDownloading }) => {
  // nbFilesDownloaded {Number} = number of files being downloaded
  // filesDownloading {Array<string>} = filenames of file being downloaded 
});

await update.run();
// update is finished here

AssetsDownloader

Download Launcher Assets of a game

Kind: global class

new AssetsDownloader(game, hash, dest)

Constructor of AssetsDownloader

ParamTypeDescription
gameStringName of the game
hashStringHash id of the Launcher Assets (sha1)
destStringDestination folder

assetsDownloader.run() ⇒ Promise.<Array.<String>>

Run the download of the Launcher Assets The download is finished after it resolve

Kind: instance method of AssetsDownloader
Returns: Promise.<Array.<String>> - List of filenames being download

Exemple

const { AssetsDownloader } = require('cytrus');
const downloader = new AssetsDownloader(game, hash, dest);

await downloader.run();
// download is finished here
1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago