@supercharge/fs
Version:
Async filesystem methods for Node.js
34 lines (33 loc) • 1.12 kB
TypeScript
export declare type FileSizeMetric = 'bytes' | 'kilobytes' | 'megabytes' | 'gigabytes' | 'terabytes' | 'petabytes';
export declare class FileSizeBuilder implements PromiseLike<number> {
/**
* Stores the file size metric.
*/
private metric;
/**
* Stores the file path.
*/
private readonly filePath;
/**
* Create a new instance for the given `filePath`.
*/
constructor(filePath: string);
inBytes(): Promise<number>;
inKb(): Promise<number>;
inMb(): Promise<number>;
inGb(): Promise<number>;
inTb(): Promise<number>;
inPb(): Promise<number>;
private setMetric;
/**
* Returns the file size with the provided metric ("bytes" by default).
*/
then<TResult1 = number, TResult2 = never>(onfulfilled: ((value: number) => TResult1 | PromiseLike<TResult1>), onrejected: ((reason: any) => TResult2 | PromiseLike<TResult2>)): PromiseLike<TResult1 | TResult2>;
private calculate;
private convert;
private toKilobytes;
private toMegabytes;
private toGigabytes;
private toTerabytes;
private toPetabytes;
}