From c35ae5e669dad61d1542b7e940eef782c13d01f9 Mon Sep 17 00:00:00 2001 From: Jesse Gibson Date: Sat, 21 May 2016 17:04:00 -0600 Subject: [PATCH] Make data.json human-readable Since the file.js module is only for development or getting started, we shouldn't have to minify the data before persisting it. In fact, it may hurt things, since it obfuscates our data structure and makes it harder to understand what's going on under the hood. In this commit, I swapped `Gun.text.ify` with JSON's `stringify` and gave it a 2-space formatting option to make the data more readable. --- lib/file.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/file.js b/lib/file.js index f64edb15..51100ab5 100644 --- a/lib/file.js +++ b/lib/file.js @@ -25,7 +25,8 @@ Gun.on('opt').event(function(gun, opts) { function writeFile(cb) { if(isWriting) return queuedWrites.push(cb); isWriting = true; - fs.writeFile(opts.file, Gun.text.ify(all), function(err) { + var contents = JSON.stringify(all, null, 2); + fs.writeFile(opts.file, contents, function(err) { var batch = queuedWrites.splice(0); isWriting = false; cb(err);