File
ts
import { FILE_SIZE_UNIT, FileStat, SourceAdapter } from "../definitions.js";
import { Directory } from "./dir.js";
import { Editor } from "./editor.js";
export interface PrefixDefinition {
dept: number;
separator: string;
}
export declare class LoomFile<T extends SourceAdapter = SourceAdapter> {
protected _adapter: T;
protected _dir: Directory;
protected _name: string;
protected _extension: string | undefined;
static from<T extends SourceAdapter>(adapter: T, dir: Directory, name: string): LoomFile<T>;
static from<T extends SourceAdapter>(adapter: T, path: string): LoomFile<T>;
constructor(_adapter: T, _dir: Directory, _name: string);
get path(): string;
get name(): string;
getNameWithoutExtension(): string;
get extension(): string | undefined;
get dir(): Directory;
get parent(): Directory;
get adapter(): T;
getSizeInBytes(): Promise<number>;
getSize(unit?: FILE_SIZE_UNIT): Promise<number>;
protected getLastModificationTime(stats: FileStat): Date;
getMeta(): Promise<{
size: number;
createdAt: Date | undefined;
updatedAt: Date;
}>;
getRawMeta(): Promise<FileStat>;
delete(): Promise<void>;
copyTo(target: Directory | LoomFile): Promise<LoomFile<SourceAdapter<FileStat>>>;
exists(): Promise<boolean>;
reader(): Promise<Editor>;
plain(): Promise<Buffer>;
text(encoding?: BufferEncoding): Promise<string>;
write(data: string | Buffer): Promise<void>;
create(): Promise<void>;
[Symbol.toPrimitive](): string;
get [Symbol.toStringTag](): string;
}