fix mkdir and mkdirSync options#175
Conversation
| **/ | ||
| @:overload(function(path:FsPath, callback:Error->Void):Void {}) | ||
| static function mkdir(path:FsPath, mode:FsMode, callback:Error->Void):Void; | ||
| static function mkdir(path:FsPath, options:FsMakeDirOptions, callback:Error->Void):Void; |
There was a problem hiding this comment.
The optional options argument can be an integer specifying mode (permission and sticky bits), or an object with a mode property and a recursive property indicating whether parent directories should be created.
Shouldn't we do EitherType<FsMode, FsMakeDirOptions>?
There was a problem hiding this comment.
Actually, there's more to it:
The callback is given a possible exception and, if recursive is true, the first directory path created, (err, [path]).
and
Returns undefined, or if recursive is true, the first directory path created.
for mkdirSync
It's a bit tricky to have proper typing for this, so we can ignore this for now, but we'll have to look into this at some point. Maybe some @:overload trick can be used for that.
| /** | ||
| * options for `Fs.mkdir` and `Fs.mkdirSync` | ||
| */ | ||
| typedef FsMakeDirOptions = { |
There was a problem hiding this comment.
I think this should be called FsMkdirOptions to be consistent with the function names :)
see below documents.
https://nodejs.org/api/fs.html#fs_fs_mkdir_path_options_callback
https://nodejs.org/api/fs.html#fs_fs_mkdirsync_path_options