How to use wrench

Comprehensive wrench code examples:

How to use wrench.mkdirSyncRecursive:

46
47
48
49
50
51
52
53
54
55
function createDir(tmpDir) {
    try {
        if (existsSync(tmpDir)) {
            wrench.rmdirSyncRecursive(tmpDir)
        }
        wrench.mkdirSyncRecursive(tmpDir)
    } catch (e) {
        return done(e)  
    }
}

How to use wrench.readdirSyncRecursive:

442
443
444
445
446
447
448
449
450
451
var files;

this.directories.forEach(function (dir) {
    console.log('Scanning source files: ' + dir);
    try {
        wrench.readdirSyncRecursive(dir).forEach(function (fn) {
            var absFn = path.normalize(path.join(dir, fn));   // './foo/bar.js' -> 'foo/bar.js'
            var ent;

            if (fs.existsSync(absFn) &&

How to use wrench.copyDirSyncRecursive:

25
26
27
28
29
30
31
32
33
34
35
36
proj1


function _beforeEach(done) {
    createDir(tmpDir)


    wrench.copyDirSyncRecursive(repoSrc, tmpReposDir, { forceDelete: true })
    wrench.copyDirSyncRecursive(filesSrc, repoDir, { forceDelete: true })
    repo = fsStore(new Repository(repoDir))
    proj = new Project(repo)
    repo1 = fsStore(new Repository(repo1Dir))

How to use wrench.rmdirSyncRecursive:

37
38
39
40
41
42
43
44
45
46
47
48
}


function _afterEach(done) {
    proj1.destroy()
    proj.destroy()
    wrench.rmdirSyncRecursive(tmpDir, true)
    done()
}


function createDir(tmpDir) {