import { Drive } from './drive'; import { File } from './file'; import { TextStream } from './text-stream'; /** * Provides access to a computer's file system. * * Probably gonna use something like https://github.com/jvilk/BrowserFS * * @see https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/filesystemobject-object */ export declare class FileSystemObject { private readonly SEP; /** * Returns a Drives collection consisting of all Drive objects available on the local machine. * @see https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/drives-property */ get Drives(): Drive[]; /** * Appends a name to an existing path. * @param path Existing path to which name is appended. Path can be absolute or relative and need not specify an existing folder. * @param name Name being appended to the existing path. * @see https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/buildpath-method */ BuildPath(path: string, name: string): string; /** * Copies one or more files from one location to another. * @param source Character string file specification, which can include wildcard characters, for one or more files to be copied. * @param destination Character string destination where the file or files from source are to be copied. Wildcard characters are not allowed. * @param overwrite Boolean value that indicates if existing files are to be overwritten. If True, files are overwritten; if False, they are not. The default is True. Note that CopyFile will fail if destination has the read-only attribute set, regardless of the value of overwrite. * @see https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/copyfile-method */ CopyFile(source: string, destination: string, overwrite?: boolean): void; /** * Recursively copies a folder from one location to another. * @param source Character string folder specification, which can include wildcard characters, for one or more folders to be copied. * @param destination Character string destination where the folder and subfolders from source are to be copied. Wildcard characters are not allowed. * @param overwrite Boolean value that indicates if existing folders are to be overwritten. If True, files are overwritten; if False, they are not. The default is True. * @see https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/copyfolder-method */ CopyFolder(source: string, destination: string, overwrite?: boolean): void; /** * Creates a folder. * @param foldername String expression that identifies the folder to create. * @https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/createfolder-method */ CreateFolder(foldername: string): void; /** * Creates a specified file name and returns a {@link TextStream} object that can be used to read from or write to the file. * * @param filename String expression that identifies the file to create. * @param overwrite Boolean value that indicates if an existing file can be overwritten. The value is True if the file can be overwritten; False if it can't be overwritten. If omitted, existing files can be overwritten. * @param unicode Boolean value that indicates whether the file is created as a Unicode or ASCII file. The value is True if the file is created as a Unicode file; False if it's created as an ASCII file. If omitted, an ASCII file is assumed. * @see https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/createtextfile-method */ CreateTextFile(filename: string, overwrite?: boolean, unicode?: boolean): TextStream | void; /** * Deletes a specified file. * @param filespec The name of the file to delete. The filespec can contain wildcard characters in the last path component. * @param force Boolean value that is True if files with the read-only attribute set are to be deleted; False (default) if they are not. * @see https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/deletefile-method */ DeleteFile(filespec: string, force?: boolean): void; /** * Deletes a specified folder and its contents. * @param folderspec The name of the folder to delete. The folderspec can contain wildcard characters in the last path component. * @param force Boolean value that is True if folders with the read-only attribute set are to be deleted; False (default) if they are not. * @see https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/deletefolder-method */ DeleteFolder(folderspec: string, force?: boolean): void; /** * Returns True if the specified drive exists; False if it does not. * @param drivespec A drive letter or a path specification for the root of the drive. * @see https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/driveexists-method */ DriveExists(drivespec: string): boolean; /** * Returns True if a specified file exists; False if it does not. * @param filespec The name of the file whose existence is to be determined. A complete path specification (either absolute or relative) must be provided if the file isn't expected to exist in the current folder. * @see https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/fileexists-method */ FileExists(filespec: string): boolean; /** * Returns True if a specified folder exists; False if it does not. * @param folderspec The name of the folder whose existence is to be determined. A complete path specification (either absolute or relative) must be provided if the folder isn't expected to exist in the current folder. * @see https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/folderexists-method */ FolderExists(folderspec: string): boolean; /** * Returns a complete and unambiguous path from a provided path specification. * @param pathspec Path specification to change to a complete and unambiguous path. * @see https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/getabsolutepathname-method */ GetAbsolutePathName(pathspec: string): string; /** * Returns a string containing the base name of the last component, less any file extension, in a path. * @param path The path specification for the component whose base name is to be returned. * @see https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/getbasename-method */ GetBaseName(path: string): string; /** * Returns a {@link Drive} object corresponding to the drive in a specified path. * @param drivespec The drivespec argument can be a drive letter (c), a drive letter with a colon appended (c:), a drive letter with a colon and path separator appended (c:), or any network share specification (\computer2\share1). * @see https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/getdrive-method */ GetDrive(drivespec: string): Drive; /** * Returns a string containing the name of the drive for a specified path. * @param path The path specification for the component whose drive name is to be returned. * @see https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/getdrivename-method */ GetDriveName(path: string): string; /** * Returns a string containing the extension name for the last component in a path. * @param path The path specification for the component whose extension name is to be returned. * @see https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/getextensionname-method */ GetExtensionName(path: string): string; /** * Returns a {@link File} object corresponding to the file in a specified path. * @param filespec The filespec is the path (absolute or relative) to a specific file. * @see https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/getfile-method */ GetFile(filespec: string): File | void; /** * Returns the last component of a specified path that is not part of the drive specification. * @param pathspec The path (absolute or relative) to a specific file. * @see https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/getfilename-method-visual-basic-for-applications */ GetFileName(pathspec: string): string; /** * Returns a Folder object corresponding to the folder in a specified path. * @param folderspec The folderspec is the path (absolute or relative) to a specific folder. * @see https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/getfolder-method */ GetFolder(folderspec: string): string; /** * Returns a string containing the name of the parent folder of the last component in a specified path. * @param path The path specification for the component whose parent folder name is to be returned. * @see https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/getparentfoldername-method */ GetParentFolderName(path: string): string; /** * Returns the special folder specified. * @param folderspec The name of the special folder to be returned. Can be any of the constants shown in the Settings section. * @constructor */ GetSpecialFolder(folderspec: number): {}; /** * Returns a randomly generated temporary file or folder name that is useful for performing operations that require a temporary file or folder. * @https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/gettempname-method */ GetTempName(): string; /** * Moves one or more files from one location to another. * @param source The path to the file or files to be moved. The source argument string can contain wildcard characters in the last path component only. * @param destination The path where the file or files are to be moved. The destination argument can't contain wildcard characters. * @see https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/movefile-method */ MoveFile(source: string, destination: string): void; /** * Moves one or more folders from one location to another. * @param source The path to the folder or folders to be moved. The source argument string can contain wildcard characters in the last path component only. * @param destination The path where the folder or folders are to be moved. The destination argument can't contain wildcard characters. * @see https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/movefolder-method */ MoveFolder(source: string, destination: string): void; /** * Opens a specified file and returns a {@link TextStream} object that can be used to read from, write to, or append to the file. * @param filename String expression that identifies the file to open. * @param mode Indicates input/output mode. Can be one of three constants: ForReading, ForWriting, or ForAppending. * @param create Boolean value that indicates whether a new file can be created if the specified filename doesn't exist. The value is True if a new file is created; False if it isn't created. The default is False. * @param format One of three Tristate values used to indicate the format of the opened file. If omitted, the file is opened as ASCII. * @see https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/opentextfile-method */ OpenTextFile(filename: string, mode?: number, create?: boolean, format?: number): TextStream | void; }