Skip to content

Latest commit

 

History

History
executable file
·
91 lines (71 loc) · 3.41 KB

cacheDemos-doc.md

File metadata and controls

executable file
·
91 lines (71 loc) · 3.41 KB

modules/cacheDemos

query demo files from drive to cache

Requires: module:path, module:fs, module:colors, module:modules/printer, module:modules/Timer

modules/cacheDemos~createdDate(file) ⇒ String

returns created date of a file

Kind: inner method of modules/cacheDemos
Returns: String - date file was modified

Param Type Description
file String path to the file

Example (Example usage of createdDate() function.)

const created = createdDate('somedemo.dem');
// console.log(created); = '2020-12-29T07:45:12.737Z'

modules/cacheDemos~getFilesizeInBytes(filename) ⇒ Number

returns file size in bytes

Kind: inner method of modules/cacheDemos
Returns: Number - file size in bytes

Param Type Description
filename String file path

Example (Example usage of getFilesileInBytes() function.)

const bytes = getFilesileInBytes('somedemo.dem');
// console.log(bytes); = 14567809

modules/cacheDemos~bytesToSize(bytes) ⇒ String

converts bytes to a readable string

Kind: inner method of modules/cacheDemos
Returns: String - readable file size

Param Type Description
bytes Number file size yay

Example (Example usage of bytesToSize() function.)

const size = bytesToSize('somedemo.dem');
// console.log(size); = '13MB'

modules/cacheDemos~getDemos() ⇒ Promise.<Arrray>

returns array of demo files from game server dir

Kind: inner method of modules/cacheDemos
Returns: Promise.<Arrray> - list of demo files
Example (Example usage of getDemos() function.)

getDemos().then(demos => {
// demos = [ list of demo files ];
});

modules/cacheDemos~cacheDemos() ⇒ Promise.<Array>

caches list of avaliable demo files

Kind: inner method of modules/cacheDemos
Returns: Promise.<Array> - list of files with readable date and file size
Example (Example usage of cacheDemos() function.)

cacheDemos().then(demoList => {
// demoList = [ list of demos with readable details ];
});