This interface is implemented by File Manager Object. It provides basic methods to work with a file system, like opening or creating files and folders, deleting files and folders and enumerating the contents of a folder.
interface IFileManager {
// Methods
${createFile}(path: string,
openMode: ${File.OpenMode},
access: ${File.Access},
share?: ${File.Share}): ${IFile};
${deleteFile}(path: string): void;
${enumFiles}(folder: string, mask?: string): Promise<string[]>;
${copyFile}(source: string, destination: string, overwrite?: boolean): Promise<void>;
${moveFile}(source: string, destination: string, overwrite?: boolean): Promise<void>;
${createFolder}(path: string): void;
${deleteFolder}(path: string): void;
}
// This interface is not available in managed environment
// This interface is not available in native environment
createFile(path: string,
openMode: ${File.OpenMode},
access: ${File.Access},
share?: ${File.Share}): ${IFile};
// This method is not available in managed environment
// This method is not available in native environment
path
openMode
access
share
File.Share.Exclusive
.An opened file object.
Creates or opens a file.
Open an existing file for reading
var file = fileManager.createFile("c:\\temp\\file.txt", File.OpenMode.OpenExisting, File.Access.Read, File.Share.Read);
deleteFile(path: string): void;
// This method is not available in managed environment
// This method is not available in native environment
path
Deletes a given file.
enumFiles(folder: string, mask?: string): Promise<string[]>;
// This method is not available in managed environment
// This method is not available in native environment
folder
mask
Enumerate files in a given folder. The method executes asynchronously and returns a list of file names that match a given mask.
Enumerating files in a folder
var files = await fileManager.enumFiles("c:\\temp", "*.txt");
copyFile(source: string, destination: string, overwrite?: boolean): Promise<void>;
// This method is not available in managed environment
// This method is not available in native environment
source
destination
overwrite
false
.Copies a source file to destination. The method executes asynchronously.
Copying a file
await fileManager.copyFile(source, destination);
moveFile(source: string, destination: string, overwrite?: boolean): Promise<void>;
// This method is not available in managed environment
// This method is not available in native environment
source
destination
overwrite
false
.Moves a source file to destination or renames a file. The method executes asynchronously.
Renaming a file
await fileManager.moveFile(source, destination);
createFolder(path: string): void;
// This method is not available in managed environment
// This method is not available in native environment
path
Creates a folder. If one or more intermediate folders in a given path do not exist, they are also created by this function.
deleteFolder(path: string): void;
// This method is not available in managed environment
// This method is not available in native environment
path
Deletes a given folder. A folder must be empty to be successfully deleted.