promisified-properties
Version:
Handle .properties file via promisified and typed API
30 lines (29 loc) • 1.58 kB
TypeScript
import { Comment, Entry } from "./types";
/**
* Parse the file pointed by the given path as [the Properties defined by Java](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Properties.html).
*
* @param path - Path to the target file to parse
* @returns Promise which returns parsed properties
*/
export declare function parseFile(path: string): Promise<Array<Comment | Entry>>;
/**
* Parse given text as [the Properties defined by Java](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Properties.html).
*
* @param data - Text to parse
* @returns Promise which returns parsed properties
*/
export declare function parse(data: string): Array<Comment | Entry>;
/**
* Convert properties data to text, based on [the spec defined by Java](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Properties.html).
* @param data - Properties data to convert into text format
* @returns Converted text which represents the given properties
*/
export declare function stringify(data: Array<Comment | Entry>): string;
/**
* Convert properties data to text, based on [the spec defined by Java](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Properties.html),
* and write it to the file pointed by the given path.
* @param data - Properties data to convert into text format
* @param path - Path to the target file to write
* @returns Promise which is resolved when file is successfully written
*/
export declare function write(data: Array<Comment | Entry>, path: string): Promise<void>;