filesysteminfo
7 min
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 players that support this (see storage devices docid\ mgdefc6yvkibeiuxh9j1o ) "/storage/ssd" – the internal ssd on players that support this (see storage devices docid\ mgdefc6yvkibeiuxh9j1o ) 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 \<font color="#704ae0">number\</font> the size of a native block sizebytes \<font color="#704ae0">number\</font> the amount of total space bytesfree \<font color="#704ae0">number\</font> the amount of free space filesused \<font color="#704ae0">number\</font> the number of used inodes filesfree \<font color="#704ae0">number\</font> the number of free inodes isreadonly \<font color="#704ae0">bool\</font> 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)); });