Make JSON.stringify pretty print
authorNick Downing <nick@ndcode.org>
Fri, 31 Dec 2021 20:21:40 +0000 (07:21 +1100)
committerNick Downing <nick@ndcode.org>
Fri, 31 Dec 2021 20:21:40 +0000 (07:21 +1100)
JSONCacheRW.js

index 5d49668..4e1f28d 100644 (file)
@@ -91,7 +91,7 @@ let write = (pathname, result, timeout, diag) => {
           console.log('writing', pathname)
         result.dirty = false
         let temp_pathname = pathname + '.temp'
-        let text = JSON.stringify(result.value) + '\n'
+        let text = JSON.stringify(result.value, null, 2) + '\n'
         try {
           await fs_writeFile(temp_pathname, text, {encoding: 'utf-8'})
           try {