Closed MM25Zamanian closed 10 months ago
JSONFile.ts
. Just make a copy of that file and name it JSONMinified.ts
(or whatever you want to call it) with a single change on line 21:
write(obj: T): Promise<void> {
return this.#adapter.write(JSON.stringify(obj, null, 2))
}
to:
write(obj: T): Promise<void> {
return this.#adapter.write(JSON.stringify(obj))
}
and boom, minified JSON.
I'm only chiming in here because I recently went through the same thought process, however, ended up coming back around, full-circle lol, in favor of using the default, pretty JSON. The space savings were not significant and if I'm truly going for a small file size, then JSON is probably a bad choice to begin with. CSV, and even traditional SQL databases, would be much better option IMO.
Why don't you minify the json files?