Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upRepository.writeFile fails if no options object is passed #577
Comments
|
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, theoptionsparameter is specified as optional. Despite this, the function fails if nooptionsobject is passed and throws this error:The error seems to get thrown when
options.encodeis 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.