import { IFileType } from './fileType.ts'; import { Attribute, INodeStatus, NodeData } from './nodeData.ts'; export type NodeConstructorData = [NodeData, RegExp?]; export declare abstract class Node { private _attributes; protected _data: NodeData; protected _knownDavService: RegExp; private readonlyAttributes; private handler; protected constructor(...[data, davService]: NodeConstructorData); /** * Get the source url to this object * There is no setter as the source is not meant to be changed manually. * You can use the rename or move method to change the source. */ get source(): string; /** * Get the encoded source url to this object for requests purposes */ get encodedSource(): string; /** * Get this object name * There is no setter as the source is not meant to be changed manually. * You can use the rename or move method to change the source. */ get basename(): string; /** * The nodes displayname * By default the display name and the `basename` are identical, * but it is possible to have a different name. This happens * on the files app for example for shared folders. */ get displayname(): string; /** * Set the displayname */ set displayname(displayname: string); /** * Get this object's extension * There is no setter as the source is not meant to be changed manually. * You can use the rename or move method to change the source. */ get extension(): string | null; /** * Get the directory path leading to this object * Will use the relative path to root if available * * There is no setter as the source is not meant to be changed manually. * You can use the rename or move method to change the source. */ get dirname(): string; /** * Is it a file or a folder ? */ abstract get type(): IFileType; /** * Get the file mime */ get mime(): string; /** * Set the file mime * Removing the mime type will set it to `application/octet-stream` */ set mime(mime: string | undefined); /** * Get the file modification time */ get mtime(): Date | undefined; /** * Set the file modification time */ set mtime(mtime: Date | undefined); /** * Get the file creation time * There is no setter as the creation time is not meant to be changed */ get crtime(): Date | undefined; /** * Get the file size */ get size(): number | undefined; /** * Set the file size */ set size(size: number | undefined); /** * Get the file attribute * This contains all additional attributes not provided by the Node class */ get attributes(): Attribute; /** * Get the file permissions */ get permissions(): number; /** * Set the file permissions */ set permissions(permissions: number); /** * Get the file owner * There is no setter as the owner is not meant to be changed */ get owner(): string | null; /** * Is this a dav-related resource ? */ get isDavResource(): boolean; /** * Get the dav root of this object * There is no setter as the root is not meant to be changed */ get root(): string; /** * Get the absolute path of this object relative to the root */ get path(): string; /** * Get the nodes file id if defined. * There is no setter as the fileid is not meant to be changed. * * @deprecated Nextcloud is migrating to snowflake ids which are strings. Use the `id` attribute instead. */ get fileid(): number | undefined; /** * Get the nodes id - if defined. * * Note: As Nextcloud is migrating to snowflake ids the id has to be a string, * due to limitations of the JavaScript number type (snowflake ids are 64bit JavaScript numbers can only accurately represent integers up to 53 bit). */ get id(): string | undefined; /** * Get the node status. */ get status(): INodeStatus | undefined; /** * Set the node status. */ set status(status: INodeStatus | undefined); /** * Move the node to a new destination * * @param destination the new source. * e.g. https://cloud.domain.com/remote.php/dav/files/emma/Photos/picture.jpg */ move(destination: string): void; /** * Rename the node * This aliases the move method for easier usage * * @param basename The new name of the node */ rename(basename: string): void; /** * Update the mtime if exists */ updateMtime(): void; /** * Update the attributes of the node * Warning, updating attributes will NOT automatically update the mtime. * * @param attributes The new attributes to update on the Node attributes */ update(attributes: Attribute): void; /** * Returns a clone of the node */ clone(): this; /** * JSON representation of the node */ toJSON(): string; } /** * Interface of the node class */ export type INode = Pick;