filer
filer copied to clipboard
Fix appendFile bug shown to fail in PR-494
As seen in PR #494, the current implementation of appendFile fails when passing a parameter that looks like { flag: 'a' } (which should succeed, since 'a' is a default value). I have included a fix and the accompanying test to verify that it works (that previous failed with the current implementation).
The reason it failed on this type of input is that validate_file_options in implementation.js only checks if the parameter is null, a function, or a string. If it is something else (which in this case in an object), it just returns it as-is. But in the case of having an object but not having an encoding specified (as in { flags: 'a' }), options.encoding is not set to the default value.
Fixes #463
@MuchtarSalimov that broke your test: ✖ should append without error when specfifying flag option (default value)