+ 3
Read the file first
Then JSON.parse
Then length property.
https://code.sololearn.com/ce6O0aTOxQi3/?ref=app
+ 2
no, your json shouldn't be of 0 bytes. If it is empty, it should be a string of two character {}
+ 1
kinda strage system you have there.
you can use fs.stat() or fs.statSync() and get .size from the result
but instead of creating empty file for new person, its better to not create the file until you need to actually write to it.
you can use fs.exist or fs.access to check if file is exist
0
empty like its only 0kb file, or empty json object like {} ?