Sucessfully writing to file, used JSON.stringify to convert [Object]s to strings. Did not preserve whitespace, but this fs operation is only for testing, thus whitespace isn't required, but would be good for human interpretation of db contents.