1.1.2 • Published 2 years ago

retro-langs v1.1.2

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

DofusRetro-Langs

Allows you to watch and download langs files for Dofus Retro.

Is available through a CLI and Class usable in your own code

(Thanks @drag0une for his work)

Table of contents

Installation

You can install the retro-langs package with npm

npm i --save retro-langs

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

retro-langs --help
retro-langs [command] --help

Langs

Watch versions.txt file on DofusRetro CDN

Kind: global class Emits: update, downloaded, watching, error

new Langs(lang, saveFolder)

Creates an instance of Langs.

ParamTypeDefaultDescription
langstringLanguage to watch (if invalid 'fr' is used)
saveFolderstring"langs"Folder used to save versions.json and swf langs files
buildstring"prod"lang build type : prod (default), temporis or beta

langs.watch(interval, downloadNewFiles)

Watch remote versions.txt file

Kind: instance method of Langs

ParamTypeDefaultDescription
intervalnumberinterval in seconds
downloadNewFilesbooleanfalsedownload new swf files on changes

langs.unwatch()

Remove the watcher of the remote versions.txt file

Kind: instance method of Langs

"update"

Langs update event

Kind: event emitted by Langs Properties

NameTypeDescription
langstringLanguage
filesArray.<string>Array of new files names (without extension)
buildstringlang build type

"downloaded"

Lang downloaded event

Kind: event emitted by Langs Properties

NameTypeDescription
langstringLanguage
filestringFile name (without extension)
pathstringFull path of the downloaded file
buildstringlang build type

"watching"

Start watching langs event

Kind: event emitted by Langs Properties

NameTypeDescription
langstringLanguage
intervalnumberinterval in seconds
saveFolderstringFull path of the downloading directory
downloadNewFilesbooleandownload new swf files
buildstringlang build type

"error"

Error event

Kind: event emitted by Langs Properties

NameTypeDescription
errorerrorError message

Exemple

const Langs = require('retro-langs');
/**
* Watched language is fr
* Working directory is ./output/dir/
* Lang build type is temporis (can also be 'beta' or 'prod' by default)
*/
const langWatcher = new Langs('fr', 'output/dir', 'temporis');

langWatcher.on('update', ({ lang, files, build }) => {
  // an update of langs is available
});

langWatcher.on('downloaded', ({ lang, file, path, build }) => {
  // a lang file has been downloaded
});

/**
* Watch every 60s
* Will be downloading every new files on changes
*/
langWatcher.watch(60, true); 
1.1.1

2 years ago

1.1.2

2 years ago

1.0.2

2 years ago

1.1.0

2 years ago

1.0.1

2 years ago

1.0.3

2 years ago

1.0.0

2 years ago