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

cytrus

v1.0.6

Published

Cytrus implementation in Node.js

Downloads

7

Readme

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

| Param | Type | Description | | --- | --- | --- | | saveFolder | String | folder 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

| Param | Type | Description | | --- | --- | --- | | interval | Number | interval 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

| Name | Type | Description | | --- | --- | --- | | game | String | Game name | | releaseName | String | Release name of the asset updated (ex: main/beta ...) | | hash | String | undefined | New hash of the asset (undefined if deleted) |

"release:update"

Release update event

Kind: event emitted by Cytrus
Properties

| Name | Type | Description | | --- | --- | --- | | game | String | Game name | | platform | String | Platform of the release (ex: windows, darwin, linux ...) | | releaseName | String | Release name of the release updated (ex: main/beta ...) | | version | String | undefined | New 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

| Name | Type | Description | | --- | --- | --- | | nbFilesDownloaded | Number | Number of files already downloaded | | nbFilesToDownload | Number | Number of files to update | | filesToUpdate | Array.<File> | List of file needed to be updated | | filesInDl | Array.<String> | List of filenames downloading |

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

| Param | Type | Description | | --- | --- | --- | | game | String | Name of the game (ex: dofus) | | platform | String | Platform of the game (ex: windows/linux/darwin) | | releaseName | String | Release of the game (ex: main/beta/...) | | version | String | Version number (ex: 5.0_2.64.9.16) | | dest | String | Destination folder | | options | Object | Options of the Downloader (see each fields default) | | options.ignoredFragments | Array.<String> | Fragments ignored (ex: ['win32'] for dofus) | | options.maxConcurrentDl | Number | Maximum 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

| Name | Type | Description | | --- | --- | --- | | total | Number | Total number of files to dl |

"progress"

Progress download event

Kind: event emitted by ReleaseDownloader
Properties

| Name | Type | Description | | --- | --- | --- | | nbFilesDownloaded | Number | How many files are already downloaded | | filesDownloading | Array.<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

| Param | Type | Description | | --- | --- | --- | | game | String | Name of the game | | hash | String | Hash id of the Launcher Assets (sha1) | | dest | String | Destination 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