Player APIs (BrightScript & Ja...
JavaScript APIs
filesysteminfo
8min
the filesysteminfo object provides information about the file system of a storage device connected to the player to retrieve information about the storage device itself, use the storageinfo object filesysteminfo idl \[ constructor(string path, string type); ] interface filesysteminfo { promise\<bool> isreadonly(); promise\<string> getfilesystemtype(); promise\<filesystemstats> getstatistics(); }; interface filesystemstats { attribute number blocksize; attribute number sizebytes; attribute number bytesfree; attribute number filesused; attribute number filesfree; attribute bool isreadonly; }; object creation to create a filesysteminfo object, first load the brightsign/filesysteminfo module using the require() method then create an instance of the filesysteminfo class with a string value specifying the storage path var filesysteminfoclass = require("@brightsign/filesysteminfo"); var filesysteminfo = new filesysteminfoclass("/storage/sd"); use the following string values to specify different storage drives "/storage/usb1" – the drive for usb storage devices connected to the player "/storage/sd" – the primary sd or microsd drive on the player "/storage/sd2" – the internal microsd drive on the player (4kx42, xdx32 models only) "/storage/ssd" – the internal ssd on the player (xtx44, xtx43, xdx34, and xdx33 models only) filesysteminfo use this interface to retrieve information about the file system isreadonly() promise\<bool> isreadonly() returns a boolean value indicating whether the filesystem is read only getfilesystemtype() promise \<domstring> getfilesystemtype() returns the filesystem type or whether it is encrypted (“+ecryptfs”) the following are potential values "exfat" "ext3" "ext4" "fat12" "fat16" "fat32" "hfs" "hfsplus" "ntfs" “+ecryptfs” (as of bos version 9 0 145 1) getstatistics() promise\<filesystemstats> getstatistics() returns a filesystemstats interface containing information about the filesystem this method can take a significant amount of time to return its promise filesystemstats this interface contains information about the filesystem blocksize number number the size of a native block sizebytes number number the amount of total space bytesfree number number the amount of free space filesused number number the number of used inodes filesfree number number the number of free inodes isreadonly bool bool a flag indicating whether the filesystem is read only example var filesysteminfoclass = require("@brightsign/filesysteminfo"); var filesysteminfo = new filesysteminfoclass("/storage/sd"); filesysteminfo getfilesystemtype() then( function(data) { console log(json stringify(data)); }) catch( function(data) { console log(json stringify(data)); }); filesysteminfo getstatistics() then( function(data) { console log(json stringify(data)); }) catch( function(data) { console log(json stringify(data)); });