Open lantchou opened 5 years ago
It seems to work without having the options parameter when the callback function is used, but ideally you should be able to call writeFile without either the options parameter or the callback function. I will look into this.
I just realized this is solved in PR #588.
After looking at this a little more closely, it looks like our old approach was to require a callback. If a function was provided as the options param, we would assume that the user was passing in the callback function. When we added promises, people stopped using callbacks, so we can no longer assume that this is a required parameter (even though the docs say it is).
In the documentation about
Repository.writeFile
, theoptions
parameter is specified as optional. Despite this, the function fails if nooptions
object is passed and throws this error:The error seems to get thrown when
options.encode
is read inRepository.writeFile
. It only works for me when passing an empty object. This should be better documented or a default empty object should be instantiated in the method.