From 57bcf722091bccd33d57a6dcaa134aaa052ed1a2 Mon Sep 17 00:00:00 2001 From: Alexei Kozachenko Date: Fri, 28 Sep 2018 00:05:44 -0400 Subject: [PATCH] Added mkdtemp method description to readme --- README.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/README.md b/README.md index 2f51838..0fad4da 100644 --- a/README.md +++ b/README.md @@ -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) + + +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) Reads the contents of a directory. Asynchronous [readdir(3)](http://pubs.opengroup.org/onlinepubs/009695399/functions/readdir.html).