0
0
mirror of https://github.com/sp-tarkov/server.git synced 2025-02-13 09:50:43 -05:00

Allow FileSystem's writeJson spacing to have more options

This commit is contained in:
Archangel 2025-01-12 18:28:56 +01:00
parent aeee1b8446
commit 7c3f41f160
2 changed files with 6 additions and 6 deletions

View File

@ -167,11 +167,11 @@ export class FileSystem {
* *
* @param file The file path to write to. * @param file The file path to write to.
* @param jsonObject The object to write to the file. * @param jsonObject The object to write to the file.
* @param indentationSpaces The number of spaces to use for indentation. * @param spacing The number of spaces or string used for spacing of the JSON file.
* @returns A promise that resolves when the write operation is complete. * @returns A promise that resolves when the write operation is complete.
*/ */
public async writeJson(file: string, jsonObject: object, indentationSpaces?: 4): Promise<void> { public async writeJson(file: string, jsonObject: object, spacing: string | number = 4): Promise<void> {
const jsonString = JSON.stringify(jsonObject, null, indentationSpaces); const jsonString = JSON.stringify(jsonObject, null, spacing);
return this.write(file, jsonString); return this.write(file, jsonString);
} }

View File

@ -165,11 +165,11 @@ export class FileSystemSync {
* *
* @param file The file path to write to. * @param file The file path to write to.
* @param jsonObject The object to write to the file. * @param jsonObject The object to write to the file.
* @param indentationSpaces The number of spaces to use for indentation. * @param spacing The number of spaces or string used for spacing of the JSON file.
* @returns void * @returns void
*/ */
public writeJson(file: string, jsonObject: object, indentationSpaces?: 4): void { public writeJson(file: string, jsonObject: object, spacing: string | number = 4): void {
const jsonString = JSON.stringify(jsonObject, null, indentationSpaces); const jsonString = JSON.stringify(jsonObject, null, spacing);
this.write(file, jsonString); this.write(file, jsonString);
} }