Added mkdtemp method description to readme

This commit is contained in:
Alexei Kozachenko 2018-09-28 00:05:44 -04:00
parent 006e34b97b
commit 57bcf72209
1 changed files with 25 additions and 0 deletions

View File

@ -306,6 +306,7 @@ var fs = new Filer.FileSystem();
* [fs.mknod(path, mode, callback)](#mknod)
* [fs.rmdir(path, callback)](#rmdir)
* [fs.mkdir(path, [mode], callback)](#mkdir)
* [fs.mkdtemp(path, [mode], callback)](#mkdtemp)
* [fs.readdir(path, callback)](#readdir)
* [fs.close(fd, callback)](#close)
* [fs.open(path, flags, [mode], callback)](#open)
@ -673,6 +674,30 @@ fs.mkdir('/home', function(err) {
});
```
#### fs.mkdtemp(prefix, options, callback)<a name="mkdtemp"></a>
Makes a temporary directory with prefix supplied in `path` argument. Method will append the six randomly selected characters directly to the prefix.
Asynchronous. Callback gets `(error, path)`, where path is a path to created directory.
NOTE: Filer allows for, but ignores the optional `options` argument used in node.js.
Example:
```javascript
// Create tmp directory with prefix foo
fs.mkdtemp("foo-", function (error, path) {
//A new folder foo-xxxxxx will be created. Path contains a path to created folder.
});
fs.mkdtemp("/myDir/tmp", function (error, path) {
//Will create a new folder tmpxxxxxx inside myDir directory.
//Will throw error if myDir does not exist
});
```
#### fs.readdir(path, callback)<a name="readdir"></a>
Reads the contents of a directory. Asynchronous [readdir(3)](http://pubs.opengroup.org/onlinepubs/009695399/functions/readdir.html).