UNPKG

axiodb

Version:

The Pure JavaScript Alternative to SQLite. Embedded NoSQL database for Node.js with MongoDB-style queries, zero native dependencies, built-in InMemoryCache, and web GUI. Perfect for desktop apps, CLI tools, and embedded systems. No compilation, no platfor

60 lines (59 loc) 2.31 kB
import { ErrorInterface, SuccessInterface } from "../../config/Interfaces/Helper/response.helper.interface"; export default class FolderManager { private readonly fileSystem; private readonly fileSystemSync; private readonly responseHelper; private readonly WorkerProcess; constructor(); /** * Creates a new directory at the specified path. */ CreateDirectory(path: string): Promise<SuccessInterface | ErrorInterface>; /** * Deletes a directory at the specified path. */ DeleteDirectory(path: string): Promise<SuccessInterface | ErrorInterface>; /** * Checks if a directory exists at the specified path. */ DirectoryExists(path: string): Promise<SuccessInterface | ErrorInterface>; /** * Lists the contents of a directory at the specified path. */ ListDirectory(path: string): Promise<SuccessInterface | ErrorInterface>; /** * Moves a directory from the old path to the new path. */ MoveDirectory(oldPath: string, newPath: string): Promise<SuccessInterface | ErrorInterface>; /** * Locks a directory at the specified path. */ LockDirectory(path: string): Promise<SuccessInterface | ErrorInterface>; /** * Unlocks a directory at the specified path. */ UnlockDirectory(path: string): Promise<SuccessInterface | ErrorInterface>; /** * Checks if a directory is locked at the specified path. */ IsDirectoryLocked(path: string): Promise<SuccessInterface | ErrorInterface>; /** * get the size of a directory at the specified path. * Handles permission issues by temporarily modifying permissions if needed. */ GetDirectorySize(path: string): Promise<SuccessInterface | ErrorInterface>; /** * Recursively prepares a directory and its contents for size calculation * by temporarily modifying permissions if needed. */ private prepareDirectoryForSizeCalculation; /** * Restores original permissions for all modified files and directories */ private restoreDirectoryPermissions; /** * Calculates directory size recursively using Node.js native functions. * This is a fallback method for when command-line tools fail. */ private calculateDirectorySizeRecursively; }