UNPKG

digitaltwin-core

Version:

Minimalist framework to collect and handle data in a Digital Twin project

51 lines 2.24 kB
import { StorageService } from '../storage_service.js'; /** * Local filesystem-based implementation of the StorageService. * Saves files in a configured folder using a timestamp as filename. */ export declare class LocalStorageService extends StorageService { private baseDir; constructor(baseDir?: string); /** * Saves the given buffer to disk under a unique filename. * @param buffer - Content to save * @param collectorName - Name of the collector (used for folder) * @param extension - Optional file extension (e.g. 'json', 'txt') * @returns Relative path to the saved file */ save(buffer: Buffer, collectorName: string, extension?: string): Promise<string>; /** * Retrieves a file as buffer using its relative path. * @param relativePath - Filename previously returned by `save` * @returns File content as Buffer */ retrieve(relativePath: string): Promise<Buffer>; /** * Deletes a stored file. * @param relativePath - Filename previously returned by `save` */ delete(relativePath: string): Promise<void>; /** * Saves the given buffer to disk at a specific path (preserves filename). * Unlike save(), this method does not auto-generate a timestamp filename. * @param buffer - Content to save * @param relativePath - Full relative path including filename (e.g., 'tilesets/123/tileset.json') * @returns The same relative path that was provided */ saveWithPath(buffer: Buffer, relativePath: string): Promise<string>; /** * Returns a local file path for the stored file. * Note: For local storage, this returns a relative file path, not an HTTP URL. * In production, use a cloud storage service (OVH, S3) for public URLs. * @param relativePath - The storage path of the file * @returns The file path (relative to baseDir) */ getPublicUrl(relativePath: string): string; /** * Deletes all files under a given prefix (folder). * @param prefix - The folder/prefix to delete (e.g., 'tilesets/123') * @returns Number of files deleted */ deleteByPrefix(prefix: string): Promise<number>; } //# sourceMappingURL=local_storage_service.d.ts.map