@aminya/minijson
Version:
Minify JSON files blazing fast, removing comments/whitespace.
27 lines (26 loc) • 1.28 kB
TypeScript
/**
* Minify all the given JSON files in place. It minifies the files in parallel.
*
* @param files An array of paths to the files
* @param hasComment A boolean to support comments in json. Default `true`.
* @returns {Promise<void>} Returns a void promise that resolves when all the files are minified
* @throws {Promise<string | Error>} The promise is rejected with the reason for failure
*/
export declare function minifyFiles(files: readonly string[], hasComment?: boolean): Promise<void>;
/**
* Spawn minijson with the given arguments
*
* @param args An array of arguments
* @returns {Promise<string>} Returns a promise that resolves to stdout output string when the operation finishes
* @throws {Promise<string | Error>} The promise is rejected with the reason for failure
*/
export declare function spawnMinijson(args: string[]): Promise<string>;
/**
* Minify the given JSON string
*
* @param jsonString The json string you want to minify
* @param hasComment A boolean to support comments in json. Default `true`.
* @returns {Promise<string>} The minified json string
* @throws {Promise<string | Error>} The promise is rejected with the reason for failure
*/
export declare function minifyString(jsonString: string, hasComment?: boolean): Promise<string>;