UNPKG

repox-countries

Version:

Provides up-to-date country, state, city, language, currency, phone code, and postal code data, sourced daily from the GeoNames API. Integrate easily into forms or use for data verification. Updated versions are released when changes occur.

20 lines (19 loc) 904 B
/** * Loads a JSON file and converts it into a Set<T>. * If the file does not exist or an error occurs, it returns an empty Set. * * @template T - The type of elements stored in the Set. * @param {string} path - The file path to load data from. * @returns {Promise<Set<T>>} - A promise that resolves to a Set containing parsed data. */ export declare const loadingFile: <T = unknown>(path: string) => Promise<Set<T>>; /** * Saves an array of data to a JSON file. * If the file exists, it overwrites it with the new data. * * @template T - The type of elements stored in the file. * @param {string} filePath - The file path where data should be saved. * @param {T} data - The array of data to be saved. * @returns {Promise<void>} - A promise that resolves once the data is written successfully. */ export declare const savingFile: <T = unknown>(filePath: string, data: T) => Promise<void>;