FileServices

File services File path parameters can be either absolute or relative.
Relative paths are resolved against the user data application directory. e.g. userdataDir/apps/ebase

FileServices Functions

appendToFile FileServices.appendToFile( filePath , text [, encoding ] ) Creates a new file if necessary with the specified file path and appends the specified text decoded using the specified encoding to the file.
base64Decode FileServices.base64Decode( encoded ) Returns decoded text from a base64 string.
base64Encode FileServices.base64Encode( bytes ) Returns the text as a Base64 encoded string
base64EncodeFile FileServices.base64EncodeFile( filename ) Returns the text as a Base64 encoded string
copyFile FileServices.copyFile( fromPath , toPath ) Copies the contents of the file represented by fromPath to toPath.
createNewDirectory FileServices.createNewDirectory( filePath ) Creates a new directory with this path name including any necessary but nonexistent parent directories.
createNewFile FileServices.createNewFile( filePath ) Creates a new file with this path name so long as a file or directory doesn't already exist with the same name.
deleteFile FileServices.deleteFile( filePath ) Deletes the file or directory with this path name.
existsFile FileServices.existsFile( filePath ) Returns true if a file or directory with this path name exists.
getAbsoluteFilePath FileServices.getAbsoluteFilePath( filePath ) Returns an absolute file path for the specified relative or absolute file path.
getParentPath FileServices.getParentPath( filePath ) Returns the path name of this file's parent directory or null if no parent exists.
isDirectory FileServices.isDirectory( filePath ) Returns true if file path represents a directory.
isFile FileServices.isFile( filePath ) Returns true if file path represents a file.
listFilesInDirectory FileServices.listFilesInDirectory( filePath ) Returns an array of file paths for all files and directories within the directory represented by file path.
moveFile FileServices.moveFile( fromPath , toPath ) Moves the file specified by fromPath to the path specified by toPath.
readFile FileServices.readFile( filePath [, encoding ] ) Returns a String value representing the contents of the file specified by file path decoded using the specified encoding.
getSeparator FileServices.getSeparator( ) Returns the system dependent file separator character.
getUserDataApplicationPath FileServices.getUserDataApplicationPath( ) Returns the file path for this application within the user data file system.
getWebAppRootFilePath FileServices.getWebAppRootFilePath( ) Returns the file path for the root directory served by Http requests for the web application.
writeFile FileServices.writeFile( filePath , text [, encoding ] ) Creates a new file if necessary with the specified file path and saves the file with the specified text decoded using the specified encoding.