/// import Client from "./client"; import File from "./file"; import FileSystemElement from "./fileSystemElement"; export interface FolderGetFilesOptions { /** * callback function to filter files */ filterFile?: (file: File) => File | null; } export default class Folder implements FileSystemElement { private client; private memento; constructor(client: Client, name: string, baseName: string, lastmod: string, id?: number); get name(): string; get baseName(): string; get lastmod(): Date; get id(): number; /** * @returns an array of subfolders * @throws Error */ getSubFolders(): Promise; /** * returns true if the current folder has a subfolder with the given base name * @param subFolderBaseName the base name of the subfolder like "products" */ hasSubFolder(subFolderBaseName: string): Promise; /** * @returns all files of the folder */ getFiles(options?: FolderGetFilesOptions): Promise; /** * creates a subfolder * @param subFolderBaseName name of the subfolder basename */ createSubFolder(subFolderBaseName: string): Promise; /** * get a file by basename * @param fileBaseName the base name of the file * @returns the file of null * @throws Error */ getFile(fileBaseName: string): Promise; /** * creates a file in the folder * @param fileBaseName the base name of the file * @param data the buffer or stream with file content * @returns the new file or null * @throws Error */ createFile(fileBaseName: string, data: Buffer | NodeJS.ReadableStream): Promise; /** * deletes the folder and the contained files * @throws Error */ delete(): Promise; /** * renames or moves the current folder to the new location * target folder must exists * @param targetFolderName the name of the target folder /f1/f2/target * @throws Error */ move(targetFolderName: string): Promise; /** * @returns the url of the folder * @throws Error */ getUrl(): string; /** * @returns the url of the folder in the UI * @throws Error */ getUIUrl(): string; /** * @returns true if the folder contains a file with the given basename * @param fileBaseName file basename * @throws Error */ containsFile(fileBaseName: string): Promise; /** * adds a tag name to the folder * @param tagName name of the tag */ addTag(tagName: string): Promise; /** * get tag names * @returns array of tag names */ getTags(): Promise; /** * removes a tag of the file * @param tagName the name of the tag */ removeTag(tagName: string): Promise; /** * add comment to folder * @param comment the comment */ addComment(comment: string): Promise; /** * get list of comments of folder * @param top number of comments to return * @param skip the offset * @returns array of comment strings * @throws Exception */ getComments(top?: number, skip?: number): Promise; private assertExistence; }