UNPKG

@pagopa/dx-cli

Version:

A CLI useful to manage DX tools.

25 lines (24 loc) 935 B
import { ResultAsync } from "neverthrow"; import { z } from "zod/v4"; /** * Reads a file from a directory with a specific filename. * * @param filePath - The path to the file to read * @returns ResultAsync with file content or error */ export declare const readFile: (filePath: string) => ResultAsync<string, Error>; /** * Generic function to read a file and parse its content with a given zod schema. * * @param filePath - The path to the file to read * @param schema - The zod schema to parse the file content with * @returns ResultAsync with the parsed data or an error */ export declare const readFileAndDecode: <T>(filePath: string, schema: z.ZodSchema<T>) => ResultAsync<T, Error>; /** * Checks if a file exists. * * @param path - The path to the file to check * @returns ResultAsync with true if the file exists, false otherwise */ export declare const fileExists: (path: string) => ResultAsync<boolean, Error>;