import * as _homer0_jimple from '@homer0/jimple'; import { J as Jimpex } from '../../index-DAUqbQ6h.js'; import { PathUtils } from '@homer0/path-utils'; import fs from 'node:fs/promises'; import '../../types/express.js'; import 'express'; import '../../types/http.js'; import 'https'; import 'http'; import 'spdy'; import 'node-fetch'; import '../../types/utils.js'; import '@homer0/simple-logger'; import '@homer0/simple-config'; import '@homer0/events-hub'; /** * The options to construct a {@link FrontendFs}. * * @group Services/FrontendFs */ type FrontendFsOptions = { /** * A dictionary with the dependencies to inject. */ inject: { pathUtils: PathUtils; }; }; /** * This service allows the application to easily work with the filesystem. The idea behind * centralizing this functionalities into a service is that is pretty common to have * bundling tools to generate the frontend, and on that process files can have different * paths or not even be generated all. The service can be extended/overwritten to * accommodate any requirements and avoid having to update or add `if`s to every `fs` call * the application does. * Another _'feature'_ of this service is that all the paths are relative to the directory * where the app executable is located, so you don't have to remember the relative path * from the place you are accessing a file to the place where it's located. * * @group Services * @group Services/FrontendFs */ declare class FrontendFs { /** * The service that generates the relative paths. */ protected readonly _pathUtils: PathUtils; /** * @param options The options to construct the service. */ constructor({ inject: { pathUtils } }: FrontendFsOptions); /** * Deletes a file from the file system. * * @param filepath The path to the file. */ delete(filepath: string): Promise; /** * Reads a file from the file system. * * @param filepath The path to the file. * @param encoding The text encoding in which the file should be read. */ read(filepath: string, encoding?: BufferEncoding): Promise; /** * Writes a file on the file system. * * @param filepath The path to the file. * @param content The contents of the file. */ write(filepath: string, content: Parameters[1]): Promise; /** * Utility method to get the path of a file relative to the application executable. * * @param filepath The path to the file. */ protected getAppPath(filepath: string): string; } /** * The service provider that once registered on the container will set an instance of * {@link FrontendFs} as the `frontendFs` service. * * @example * * // Register it on the container * container.register(frontendFsProvider); * // Getting access to the service instance * const frontendFs = container.get('frontendFs'); * * @group Providers * @group Services/FrontendFs */ declare const frontendFsProvider: _homer0_jimple.Resource<"provider", "register", _homer0_jimple.ProviderRegisterFn>; export { FrontendFs, type FrontendFsOptions, frontendFsProvider };