Added/fixed mkdtemp method (issue 441)

This commit is contained in:
Alexei Kozachenko 2018-09-22 23:45:20 -04:00
parent ec2b56893e
commit 67ea230e07
1 changed files with 4 additions and 4 deletions

View File

@ -1687,19 +1687,19 @@ function mkdtemp(fs, context, prefix, options, callback) {
return 'xxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
return v.toString(16);
})
});
}
if (prefix) {
var path = "/"+prefix+generateRandom();
var path = '/'+prefix+generateRandom();
make_directory(context, path, function(error) {
if (error) {
callback(error, path)
callback(error, path);
} else {
callback(null, path);
}
});
} else {
callback(new Error('filename prefix is required'), prefix)
callback(new Error('filename prefix is required'), prefix);
}
}