2c5f55c480f46b381e11dfa67487a815ce43fb12.svn-base
953 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/**
 * Temporary - The lord of tmp.
 *
 * Author: Veselin Todorov <hi@vesln.com>
 * Licensed under the MIT License.
 */
/**
 * Dependencies.
 */
var fs = require('fs');
var path = require('path');
var generator = require('./generator');
var detector = require('./detector');
var Base = require('./base');
/**
 * Dir constructor.
 *
 * @param {String|null} name
 */
function Dir(name) {
  this.init(name);
};
/**
 * Dir extends from tmp.
 */
Dir.prototype.__proto__ = Base.prototype;
/**
 * Creates new file.
 *
 * @param {String} dirname
 */
Dir.prototype.create = function(dirname) {
  return fs.mkdirSync(path.normalize(dirname), 0777);
};
/**
 * Asynchronous dir.
 */
Dir.prototype.rmdir = function() {
  fs.rmdir.apply(fs, this.prepareArgs(arguments));
};
/**
 * Synchronous rmdir.
 */
Dir.prototype.rmdirSync = function() {
  return fs.rmdirSync.apply(fs, this.prepareArgs(arguments));
};
/**
 * Exporting the lib.
 */
module.exports = Dir;