@@ -22,7 +22,10 @@ a six letter random identifier. And just in case that you do not have that much
2222entropy left on your system, Tmp will fall back to pseudo random numbers.
2323
2424You can set whether you want to remove the temporary file on process exit or
25- not, and the destination directory can also be set.
25+ not.
26+
27+ And if you do not want to store your temporary directories and files in the
28+ standard OS temporary directory, then you are free to override that as well.
2629
2730## An Important Note on Compatibility
2831
@@ -285,12 +288,16 @@ console.log('Dir: ', tmpobj.name);
285288
286289### Asynchronous filename generation
287290
288- The ` tmpName() ` function accepts the ` prefix ` , ` postfix ` , ` dir ` , etc. parameters also:
291+ Using ` tmpName() ` you can create temporary file names asynchronously.
292+ The function accepts all standard options, e.g. ` prefix ` , ` postfix ` , ` dir ` , and so on.
293+ And you can also leave out the options altogether and just call the function with a callback as first parameter.
289294
290295``` javascript
291296var tmp = require (' tmp' );
292297
293- tmp .tmpName ({ template: ' /tmp/tmp-XXXXXX' }, function _tempNameGenerated (err , path ) {
298+ var options = {};
299+
300+ tmp .tmpName (options, function _tempNameGenerated (err , path ) {
294301 if (err) throw err;
295302
296303 console .log (' Created temporary filename: ' , path);
@@ -300,10 +307,12 @@ tmp.tmpName({ template: '/tmp/tmp-XXXXXX' }, function _tempNameGenerated(err, pa
300307### Synchronous filename generation
301308
302309The ` tmpNameSync() ` function works similarly to ` tmpName() ` .
310+ Again, you can leave out the options altogether and just invoke the function without any parameters.
303311
304312``` javascript
305313var tmp = require (' tmp' );
306- var tmpname = tmp .tmpNameSync ({ template: ' /tmp/tmp-XXXXXX' });
314+ var options = {};
315+ var tmpname = tmp .tmpNameSync (options);
307316console .log (' Created temporary filename: ' , tmpname);
308317```
309318
@@ -328,8 +337,8 @@ All options are optional :)
328337 * ` template ` : [ ` mkstemp ` ] [ 3 ] like filename template, no default
329338 * ` dir ` : the optional temporary directory, fallbacks to system default (guesses from environment)
330339 * ` tries ` : how many times should the function try to get a unique filename before giving up, default ` 3 `
331- * ` keep ` : signals that the temporary file or directory should not be deleted on exit, default is ` false ` , means delete
332- * Please keep in mind that it is recommended in this case to call the provided ` cleanupCallback ` function manually.
340+ * ` keep ` : signals that the temporary file or directory should not be deleted on exit, default is ` false `
341+ * In order to clean up, you will have to call the provided ` cleanupCallback ` function manually.
333342 * ` unsafeCleanup ` : recursively removes the created temporary directory, even when it's not empty. default is ` false `
334343
335344[ 1 ] : http://nodejs.org/
0 commit comments