FileService

Overview

SERVICE This class is a "service" and it is automatically injected if declared as a member in the constructor of the consuming class. - See the constructor section below for details - See the Automatic Instance Injection page for details on the topic

The FileService class provides methods to work with files

No properties

There is a difference in the behaviour of the FileService API in mobile and backend apps. Read the File Access documentation for more details

▶️ fileWrite(fileName: string, fileContent:string): Promise<void>

fileWrite method creates new file with given filename and filecontent. The method will overwrite the file if it already exists without throwing error

fileRead(fileName: string): Promise<string>

fileRead method reads and returns the content of existing file by given filename. The method throws error if the file does not exists.

fileDelete(fileName: string): Promise<void>

fileDelete method deletes a file by given filename. The method will not throw error if the file does not exists.

fileExists(fileName: string): Promise<boolean>

fileExists method returns true if the file with the given filename exists.

getDirFiles(folder: string): Promise<Array<string>>

getDirFiles method returns list of files contained in the given folder.

Last updated

Dynamics Mobile provided by Mobile Affairs Ltd. | 1712 Sofia, Bulgaria, Alexander Malinov 51 | sales@dynamicsmobile.com