jprichardson / node-jsonfile

Easily read/write JSON files.
MIT License
1.2k stars 321 forks source link

writeFile options argument broken #28

Closed sam-github closed 9 years ago

sam-github commented 9 years ago

The docs are wrong:

https://github.com/jprichardson/node-jsonfile#writefilefilename-options-callback

they don't describe the data argument, I assume it should be writeFile(filename, obj, [options], callback)

Also, documented behaviour is

Pass in any fs.writeFile options

That includes the string, 'utf-8', but passing in a string was broken by:

https://github.com/jprichardson/node-jsonfile/commit/e4d8e67a0c4c3630fd53c4d5bd22e3fec4c30a06

jprichardson commented 9 years ago

Fixed in https://github.com/jprichardson/node-jsonfile/commit/44cf5625cea25ca98462ed5411e43b46b9913439 with more tests. Published in 2.2.1. Sorry about the trouble.

sam-github commented 9 years ago

Thanks for fixing.