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AAE,aAAa,YAAY,KAAK,KAE/C,EAAQ,KAAK,GAAG,GAAK,KAAK,GAGjC,CAXD,GAaA,QAAQ,UAAR,CAAmB,IAEnB,OAAO,QAAU","file":"/npm/nofs@0.12.3/dist/main.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/nofs@0.12.3/dist/main.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","'use strict';\nvar Promise, _, child_process, fs, fs_exists, nofs, npath;\n\n_ = require('./utils');\n\nnpath = require('./path');\n\nchild_process = require('child_process');\n\n/**\n * Here I use [Yaku](https://github.com/ysmood/yaku) only as an ES6 shim for Promise.\n * No APIs other than ES6 spec will be used. In the\n * future it will be removed.\n */\n\nPromise = _.Promise;\n\nfs = _.extend({}, require('fs'));\n\nfs_exists = fs.exists;\n\nfs.exists = function(path, fn) {\n    return fs_exists(path, function(exists) {\n        return fn(null, exists);\n    });\n};\n\n(function() {\n    var k, name, results;\n    results = [];\n    for (k in fs) {\n        if (k.slice(-4) === 'Sync') {\n            name = k.slice(0, -4);\n            results.push(fs[name] = _.PromiseUtils.promisify(fs[name]));\n        } else {\n            results.push(void 0);\n        }\n    }\n    return results;\n})();\n\nnofs = _.extend({}, {\n\n    /**\n     * Copy an empty directory.\n     * @param  {String} src\n     * @param  {String} dest\n     * @param  {Object} opts\n     * ```js\n     * {\n     *     isForce: false,\n     *     mode: auto\n     * }\n     * ```\n     * @return {Promise}\n     */\n    copyDir: function(src, dest, opts) {\n        var copy;\n        _.defaults(opts, {\n            isForce: false\n        });\n        copy = function() {\n            return (opts.isForce ? fs.mkdir(dest, opts.mode)[\"catch\"](function(err) {\n                if (err.code !== 'EEXIST') {\n                    return Promise.reject(err);\n                }\n            }) : fs.mkdir(dest, opts.mode))[\"catch\"](function(err) {\n                if (err.code === 'ENOENT') {\n                    return nofs.mkdirs(dest);\n                } else {\n                    return Promise.reject(err);\n                }\n            });\n        };\n        if (opts.mode) {\n            return copy();\n        } else {\n            return fs.stat(src).then(function(arg) {\n                var mode;\n                mode = arg.mode;\n                opts.mode = mode;\n                return copy();\n            });\n        }\n    },\n    copyDirSync: function(src, dest, opts) {\n        var copy, mode;\n        _.defaults(opts, {\n            isForce: false\n        });\n        copy = function() {\n            var err, error, error1;\n            try {\n                if (opts.isForce) {\n                    try {\n                        return fs.mkdirSync(dest, opts.mode);\n                    } catch (error) {\n                        err = error;\n                        if (err.code !== 'EEXIST') {\n                            throw err;\n                        }\n                    }\n                } else {\n                    return fs.mkdirSync(dest, opts.mode);\n                }\n            } catch (error1) {\n                err = error1;\n                if (err.code === 'ENOENT') {\n                    return nofs.mkdirsSync(dest);\n                } else {\n                    throw err;\n                }\n            }\n        };\n        if (opts.mode) {\n            return copy();\n        } else {\n            mode = fs.statSync(src).mode;\n            opts.mode = mode;\n            return copy();\n        }\n    },\n\n    /**\n     * Copy a single file.\n     * @param  {String} src\n     * @param  {String} dest\n     * @param  {Object} opts\n     * ```js\n     * {\n     *     isForce: false,\n     *     mode: auto\n     * }\n     * ```\n     * @return {Promise}\n     */\n    copyFile: function(src, dest, opts) {\n        var copy, copyFile;\n        _.defaults(opts, {\n            isForce: false\n        });\n        copyFile = function() {\n            return new Promise(function(resolve, reject) {\n                var err, error, sDest, sSrc;\n                try {\n                    sDest = fs.createWriteStream(dest, opts);\n                    sSrc = fs.createReadStream(src);\n                } catch (error) {\n                    err = error;\n                    reject(err);\n                }\n                sSrc.on('error', reject);\n                sDest.on('error', reject);\n                sDest.on('close', resolve);\n                return sSrc.pipe(sDest);\n            });\n        };\n        copy = function() {\n            return (opts.isForce ? fs.unlink(dest)[\"catch\"](function(err) {\n                if (err.code !== 'ENOENT') {\n                    return Promise.reject(err);\n                }\n            }).then(function() {\n                return copyFile();\n            }) : copyFile())[\"catch\"](function(err) {\n                if (err.code === 'ENOENT') {\n                    return nofs.mkdirs(npath.dirname(dest)).then(copyFile);\n                } else {\n                    return Promise.reject(err);\n                }\n            });\n        };\n        if (opts.mode) {\n            return copy();\n        } else {\n            return fs.stat(src).then(function(arg) {\n                var mode;\n                mode = arg.mode;\n                opts.mode = mode;\n                return copy();\n            });\n        }\n    },\n    copyFileSync: function(src, dest, opts) {\n        var buf, blkSz, copy, copyFile, mode;\n        _.defaults(opts, {\n            blockSize: 64 * 1024,\n            isForce: false\n        });\n        blkSz = opts.blockSize;\n        buf = Buffer.alloc(blkSz);\n        copyFile = function() {\n            var bytesRead, fdr, fdw, pos;\n            fdr = fs.openSync(src, 'r');\n            fdw = fs.openSync(dest, 'w', opts.mode);\n            bytesRead = 1;\n            pos = 0;\n            while (bytesRead > 0) {\n                bytesRead = fs.readSync(fdr, buf, 0, blkSz, pos);\n                fs.writeSync(fdw, buf, 0, bytesRead);\n                pos += bytesRead;\n            }\n            fs.closeSync(fdr);\n            return fs.closeSync(fdw);\n        };\n        copy = function() {\n            var err, error, error1;\n            try {\n                if (opts.isForce) {\n                    try {\n                        fs.unlinkSync(dest);\n                    } catch (error) {\n                        err = error;\n                        if (err.code !== 'ENOENT') {\n                            throw err;\n                        }\n                    }\n                    return copyFile();\n                } else {\n                    return copyFile();\n                }\n            } catch (error1) {\n                err = error1;\n                if (err.code === 'ENOENT') {\n                    nofs.mkdirsSync(npath.dirname(dest));\n                    return copyFile();\n                } else {\n                    throw err;\n                }\n            }\n        };\n        if (opts.mode) {\n            return copy();\n        } else {\n            mode = fs.statSync(src).mode;\n            opts.mode = mode;\n            return copy();\n        }\n    },\n\n    /**\n     * Like `cp -r`.\n     * @param  {String} from Source path.\n     * @param  {String} to Destination path.\n     * @param  {Object} opts Extends the options of [eachDir](#eachDir-opts).\n     * Defaults:\n     * ```js\n     * {\n     *     // Overwrite file if exists.\n     *     isForce: false,\n     *     isIterFileOnly: false\n     *\n     *     filter: (fileInfo) => true\n     * }\n     * ```\n     * @return {Promise}\n     * @example\n     * Copy the contents of the directory rather than copy the directory itself.\n     * ```js\n     * nofs.copy('dir/path/**', 'dest/path');\n     *\n     * nofs.copy('dir/path', 'dest/path', {\n     *     filter: (fileInfo) => {\n     *         return /\\d+/.test(fileInfo.path);\n     *     }\n     * });\n     * ```\n     */\n    copy: function(from, to, opts) {\n        var flags, pm, filter;\n        if (opts == null) {\n            opts = {};\n        }\n        _.defaults(opts, {\n            isForce: false,\n            isIterFileOnly: false,\n            filter: function () { return true; }\n        });\n\n        flags = opts.isForce ? 'w' : 'wx';\n\n        filter = opts.filter;\n\n        opts.iter = function(src, dest, arg) {\n            if (_.isFunction(filter) && !filter(arg)) return;\n\n            var isDir, stats;\n            isDir = arg.isDir, stats = arg.stats;\n\n            if (isDir) {\n                return nofs.copyDir(src, dest, {\n                    isForce: true,\n                    mode: opts.mode\n                });\n            } else {\n                return nofs.copyFile(src, dest, {\n                    isForce: opts.isForce,\n                    mode: opts.mode\n                });\n            }\n        };\n        if (pm = nofs.pmatch.isPmatch(from)) {\n            from = nofs.pmatch.getPlainPath(pm);\n            pm = npath.relative(from, pm.pattern);\n            opts.filter = pm;\n        }\n        return nofs.dirExists(to).then(function(exists) {\n            if (exists) {\n                if (!pm) {\n                    return to = npath.join(to, npath.basename(from));\n                }\n            } else {\n                return nofs.mkdirs(npath.dirname(to));\n            }\n        }).then(function() {\n            return fs.stat(from);\n        }).then(function(stats) {\n            var isDir;\n            isDir = stats.isDirectory();\n            if (isDir) {\n                return nofs.mapDir(from, to, opts);\n            } else {\n                return opts.iter(from, to, {\n                    isDir: isDir,\n                    stats: stats\n                });\n            }\n        });\n    },\n    copySync: function(from, to, opts) {\n        var flags, isDir, pm, stats, filter;\n        if (opts == null) {\n            opts = {};\n        }\n        _.defaults(opts, {\n            isForce: false,\n            isIterFileOnly: false,\n            filter: function () { return true; }\n        });\n\n        flags = opts.isForce ? 'w' : 'wx';\n\n        filter = opts.filter;\n\n        opts.iter = function(src, dest, arg) {\n            if (_.isFunction(filter) && !filter(arg)) return;\n\n            var isDir, stats;\n            isDir = arg.isDir, stats = arg.stats;\n\n            if (isDir) {\n                return nofs.copyDirSync(src, dest, {\n                    isForce: true,\n                    mode: opts.mode\n                });\n            } else {\n                return nofs.copyFileSync(src, dest, {\n                    isForce: opts.isForce,\n                    mode: opts.mode\n                });\n            }\n        };\n        if (pm = nofs.pmatch.isPmatch(from)) {\n            from = nofs.pmatch.getPlainPath(pm);\n            pm = npath.relative(from, pm.pattern);\n            opts.filter = pm;\n        }\n        if (nofs.dirExistsSync(to)) {\n            if (!pm) {\n                to = npath.join(to, npath.basename(from));\n            }\n        } else {\n            nofs.mkdirsSync(npath.dirname(to));\n        }\n        stats = fs.statSync(from);\n        isDir = stats.isDirectory();\n        if (isDir) {\n            return nofs.mapDirSync(from, to, opts);\n        } else {\n            return opts.iter(from, to, {\n                isDir: isDir,\n                stats: stats\n            });\n        }\n    },\n\n    /**\n     * Check if a path exists, and if it is a directory.\n     * @param  {String}  path\n     * @return {Promise} Resolves a boolean value.\n     */\n    dirExists: function(path) {\n        return fs.stat(path).then(function(stats) {\n            return stats.isDirectory();\n        })[\"catch\"](function() {\n            return false;\n        });\n    },\n    dirExistsSync: function(path) {\n        if (fs.existsSync(path)) {\n            return fs.statSync(path).isDirectory();\n        } else {\n            return false;\n        }\n    },\n\n    /**\n     * <a name='eachDir'></a>\n     * Concurrently walks through a path recursively with a callback.\n     * The callback can return a Promise to continue the sequence.\n     * The resolving order is also recursive, a directory path resolves\n     * after all its children are resolved.\n     * @param  {String} spath The path may point to a directory or a file.\n     * @param  {Object} opts Optional. <a id='eachDir-opts'></a> Defaults:\n     * ```js\n     * {\n     *     // Callback on each path iteration.\n     *     iter: (fileInfo) => Promise | Any,\n     *\n     *     // Auto check if the spath is a minimatch pattern.\n     *     isAutoPmatch: true,\n     *\n     *     // Include entries whose names begin with a dot (.), the posix hidden files.\n     *     all: true,\n     *\n     *     // To filter paths. It can also be a RegExp or a glob pattern string.\n     *     // When it's a string, it extends the Minimatch's options.\n     *     filter: (fileInfo) => true,\n     *\n     *     // The current working directory to search.\n     *     cwd: '',\n     *\n     *     // Call iter only when it is a file.\n     *     isIterFileOnly: false,\n     *\n     *     // Whether to include the root directory or not.\n     *     isIncludeRoot: true,\n     *\n     *     // Whehter to follow symbol links or not.\n     *     isFollowLink: true,\n     *\n     *     // Iterate children first, then parent folder.\n     *     isReverse: false,\n     *\n     *     // When isReverse is false, it will be the previous iter resolve value.\n     *     val: any,\n     *\n     *     // If it return false, sub-entries won't be searched.\n     *     // When the `filter` option returns false, its children will\n     *     // still be itered. But when `searchFilter` returns false, children\n     *     // won't be itered by the iter.\n     *     searchFilter: (fileInfo) => true,\n     *\n     *     // If you want sort the names of each level, you can hack here.\n     *     // Such as `(names) => names.sort()`.\n     *     handleNames: (names) => names\n     * }\n     * ```\n     * The argument of `opts.iter`, `fileInfo` object has these properties:\n     * ```js\n     * {\n     *     path: String,\n     *     name: String,\n     *     baseDir: String,\n     *     isDir: Boolean,\n     *     children: [fileInfo],\n     *     stats: fs.Stats,\n     *     val: Any\n     * }\n     * ```\n     * Assume we call the function: `nofs.eachDir('dir', { iter: (f) => f })`,\n     * the resolved directory object array may look like:\n     * ```js\n     * {\n     *     path: 'some/dir/path',\n     *     name: 'path',\n     *     baseDir: 'some/dir',\n     *     isDir: true,\n     *     val: 'test',\n     *     children: [\n     *         {\n     *             path: 'some/dir/path/a.txt', name: 'a.txt',\n     *             baseDir: 'dir', isDir: false, stats: { ... }\n     *         },\n     *         { path: 'some/dir/path/b.txt', name: 'b.txt', ... }\n     *     ],\n     *     stats: {\n     *         size: 527,\n     *         atime: 'Mon, 10 Oct 2011 23:24:11 GMT',\n     *         mtime: 'Mon, 10 Oct 2011 23:24:11 GMT',\n     *         ctime: 'Mon, 10 Oct 2011 23:24:11 GMT'\n     *         ...\n     *     }\n     * }\n     * ```\n     * The `stats` is a native `fs.Stats` object.\n     * @return {Promise} Resolves a directory tree object.\n     * @example\n     * ```js\n     * // Print all file and directory names, and the modification time.\n     * nofs.eachDir('dir/path', {\n     *     iter: (obj, stats) =>\n     *         console.log(obj.path, stats.mtime)\n     * });\n     *\n     * // Print path name list.\n     * nofs.eachDir('dir/path', { iter: (curr) => curr })\n     * .then((tree) =>\n     *     console.log(tree)\n     * );\n     *\n     * // Find all js files.\n     * nofs.eachDir('dir/path', {\n     *     filter: '**\\/*.js',\n     *     iter: ({ path }) =>\n     *         console.log(paths)\n     * });\n     *\n     * // Find all js files.\n     * nofs.eachDir('dir/path', {\n     *     filter: /\\.js$/,\n     *     iter: ({ path }) =>\n     *         console.log(paths)\n     * });\n     *\n     * // Custom filter.\n     * nofs.eachDir('dir/path', {\n     *     filter: ({ path, stats }) =>\n     *         path.slice(-1) != '/' && stats.size > 1000\n     *     iter: (path) =>\n     *         console.log(path)\n     * });\n     * ```\n     */\n    eachDir: function(spath, opts) {\n        var decideNext, execFn, handleFilter, handleSpath, raceResolver, readdir, resolve, stat;\n        if (opts == null) {\n            opts = {};\n        }\n        _.defaults(opts, {\n            isAutoPmatch: true,\n            all: true,\n            filter: function() {\n                return true;\n            },\n            searchFilter: function() {\n                return true;\n            },\n            handleNames: function(names) {\n                return names;\n            },\n            cwd: '',\n            isIterFileOnly: false,\n            isIncludeRoot: true,\n            isFollowLink: true,\n            isReverse: false\n        });\n        stat = opts.isFollowLink ? fs.stat : fs.lstat;\n        handleSpath = function() {\n            var pm;\n            spath = npath.normalize(spath);\n            if (opts.isAutoPmatch && (pm = nofs.pmatch.isPmatch(spath))) {\n                if (nofs.pmatch.isNotPlain(pm)) {\n                    // keep the user defined filter\n                    opts._filter = opts.filter;\n                    opts.filter = pm;\n                }\n                return spath = nofs.pmatch.getPlainPath(pm);\n            }\n        };\n\n        handleFilter = function() {\n            var pm, reg;\n            if (_.isRegExp(opts.filter)) {\n                reg = opts.filter;\n                opts.filter = function(fileInfo) {\n                    return reg.test(fileInfo.path);\n                };\n                return;\n            }\n            pm = null;\n            if (_.isString(opts.filter)) {\n                pm = new nofs.pmatch.Minimatch(opts.filter);\n            }\n            if (opts.filter instanceof nofs.pmatch.Minimatch) {\n                pm = opts.filter;\n            }\n            if (pm) {\n                opts.filter = function(fileInfo) {\n                    // Hot fix for minimatch, it should match '**' to '.'.\n                    if (fileInfo.path === '.') {\n                        return pm.match('');\n                    }\n                    return pm.match(fileInfo.path) && (_.isFunction(opts._filter) ? opts._filter(fileInfo) : true);\n                };\n                return opts.searchFilter = function(fileInfo) {\n                    // Hot fix for minimatch, it should match '**' to '.'.\n                    if (fileInfo.path === '.') {\n                        return true;\n                    }\n                    return pm.match(fileInfo.path, true) && (_.isFunction(opts._searchFilter) ? opts._searchFilter(fileInfo) : true);\n                };\n            }\n        };\n\n        resolve = function(path) {\n            return npath.join(opts.cwd, path);\n        };\n\n        execFn = function(fileInfo) {\n            if (!opts.all && fileInfo.name[0] === '.') {\n                return;\n            }\n            if (opts.isIterFileOnly && fileInfo.isDir) {\n                return;\n            }\n            if ((opts.iter != null) && opts.filter(fileInfo)) {\n                return opts.iter(fileInfo);\n            }\n        };\n\n        // TODO: Race Condition\n        // It's possible that the file has already gone.\n        // Here we silently ignore it, since you normally don't\n        // want to iterate a non-exists path.\n        raceResolver = function(err) {\n            if (err.code !== 'ENOENT') {\n                return Promise.reject(err);\n            }\n        };\n\n        decideNext = function(dir, name) {\n            var path;\n            path = npath.join(dir, name);\n            return stat(resolve(path))[\"catch\"](raceResolver).then(function(stats) {\n                var fileInfo, isDir, p;\n                if (!stats) {\n                    return;\n                }\n                isDir = stats.isDirectory();\n                if (opts.baseDir === void 0) {\n                    opts.baseDir = isDir ? spath : npath.dirname(spath);\n                }\n                fileInfo = {\n                    path: path,\n                    name: name,\n                    baseDir: opts.baseDir,\n                    isDir: isDir,\n                    stats: stats\n                };\n                if (isDir) {\n                    if (!opts.searchFilter(fileInfo)) {\n                        return;\n                    }\n                    if (opts.isReverse) {\n                        return readdir(path).then(function(children) {\n                            fileInfo.children = children;\n                            return execFn(fileInfo);\n                        });\n                    } else {\n                        p = execFn(fileInfo);\n                        if (!p || !p.then) {\n                            p = Promise.resolve(p);\n                        }\n                        return p.then(function(val) {\n                            return readdir(path).then(function(children) {\n                                fileInfo.children = children;\n                                fileInfo.val = val;\n                                return fileInfo;\n                            });\n                        });\n                    }\n                } else {\n                    return execFn(fileInfo);\n                }\n            });\n        };\n        readdir = function(dir) {\n            return fs.readdir(resolve(dir))[\"catch\"](raceResolver).then(function(names) {\n                if (!names) {\n                    return;\n                }\n                return Promise.all(opts.handleNames(names).map(function(name) {\n                    return decideNext(dir, name);\n                }));\n            });\n        };\n        handleSpath();\n        handleFilter();\n        if (opts.isIncludeRoot) {\n            return decideNext(npath.dirname(spath), npath.basename(spath));\n        } else {\n            return readdir(spath);\n        }\n    },\n    eachDirSync: function(spath, opts) {\n        var decideNext, execFn, handleFilter, handleSpath, raceResolver, readdir, resolve, stat;\n        if (opts == null) {\n            opts = {};\n        }\n        _.defaults(opts, {\n            isAutoPmatch: true,\n            all: true,\n            filter: function() {\n                return true;\n            },\n            searchFilter: function() {\n                return true;\n            },\n            handleNames: function(names) {\n                return names;\n            },\n            cwd: '',\n            isIterFileOnly: false,\n            isIncludeRoot: true,\n            isFollowLink: true,\n            isReverse: false\n        });\n        stat = opts.isFollowLink ? fs.statSync : fs.lstatSync;\n        handleSpath = function() {\n            var pm;\n            spath = npath.normalize(spath);\n            if (opts.isAutoPmatch && (pm = nofs.pmatch.isPmatch(spath))) {\n                if (nofs.pmatch.isNotPlain(pm)) {\n                    opts._filter = opts.filter;\n                    opts.filter = pm;\n                }\n                return spath = nofs.pmatch.getPlainPath(pm);\n            }\n        };\n        handleFilter = function() {\n            var pm, reg;\n            if (_.isRegExp(opts.filter)) {\n                reg = opts.filter;\n                opts.filter = function(fileInfo) {\n                    return reg.test(fileInfo.path);\n                };\n                return;\n            }\n            pm = null;\n            if (_.isString(opts.filter)) {\n                pm = new nofs.pmatch.Minimatch(opts.filter);\n            }\n            if (opts.filter instanceof nofs.pmatch.Minimatch) {\n                pm = opts.filter;\n            }\n            if (pm) {\n                opts.filter = function(fileInfo) {\n                    if (fileInfo.path === '.') {\n                        return pm.match('');\n                    }\n                    return pm.match(fileInfo.path) && (_.isFunction(opts._filter) ? opts._filter(fileInfo) : true);\n                };\n                return opts.searchFilter = function(fileInfo) {\n                    if (fileInfo.path === '.') {\n                        return true;\n                    }\n                    return pm.match(fileInfo.path, true) && (_.isFunction(opts._searchFilter) ? opts._searchFilter(fileInfo) : true);\n                };\n            }\n        };\n        resolve = function(path) {\n            return npath.join(opts.cwd, path);\n        };\n        execFn = function(fileInfo) {\n            if (!opts.all && fileInfo.name[0] === '.') {\n                return;\n            }\n            if (opts.isIterFileOnly && fileInfo.isDir) {\n                return;\n            }\n            if ((opts.iter != null) && opts.filter(fileInfo)) {\n                return opts.iter(fileInfo);\n            }\n        };\n        raceResolver = function(err) {\n            if (err.code !== 'ENOENT') {\n                throw err;\n            }\n        };\n        decideNext = function(dir, name) {\n            var children, err, error, fileInfo, isDir, path, stats, val;\n            path = npath.join(dir, name);\n            try {\n                stats = stat(resolve(path));\n                isDir = stats.isDirectory();\n            } catch (error) {\n                err = error;\n                raceResolver(err);\n                return;\n            }\n            if (opts.baseDir === void 0) {\n                opts.baseDir = isDir ? spath : npath.dirname(spath);\n            }\n            fileInfo = {\n                path: path,\n                name: name,\n                baseDir: opts.baseDir,\n                isDir: isDir,\n                stats: stats\n            };\n            if (isDir) {\n                if (!opts.searchFilter(fileInfo)) {\n                    return;\n                }\n                if (opts.isReverse) {\n                    children = readdir(path);\n                    fileInfo.children = children;\n                    return execFn(fileInfo);\n                } else {\n                    val = execFn(fileInfo);\n                    children = readdir(path);\n                    fileInfo.children = children;\n                    fileInfo.val = val;\n                    return fileInfo;\n                }\n            } else {\n                return execFn(fileInfo);\n            }\n        };\n        readdir = function(dir) {\n            var err, error, names;\n            try {\n                names = fs.readdirSync(resolve(dir));\n            } catch (error) {\n                err = error;\n                raceResolver(err);\n                return;\n            }\n            return opts.handleNames(names).map(function(name) {\n                return decideNext(dir, name);\n            });\n        };\n        handleSpath();\n        handleFilter();\n        if (opts.isIncludeRoot) {\n            return decideNext(npath.dirname(spath), npath.basename(spath));\n        } else {\n            return readdir(spath);\n        }\n    },\n\n    /**\n     * Ensures that the file exists.\n     * Change file access and modification times.\n     * If the file does not exist, it is created.\n     * If the file exists, it is NOT MODIFIED.\n     * @param  {String} path\n     * @param  {Object} opts\n     * @return {Promise}\n     */\n    ensureFile: function(path, opts) {\n        if (opts == null) {\n            opts = {};\n        }\n        return nofs.fileExists(path).then(function(exists) {\n            if (exists) {\n                return Promise.resolve();\n            } else {\n                return nofs.outputFile(path, Buffer.from(''), opts);\n            }\n        });\n    },\n    ensureFileSync: function(path, opts) {\n        if (opts == null) {\n            opts = {};\n        }\n        if (!nofs.fileExistsSync(path)) {\n            return nofs.outputFileSync(path, Buffer.from(''), opts);\n        }\n    },\n\n    /**\n     * Check if a path exists, and if it is a file.\n     * @param  {String}  path\n     * @return {Promise} Resolves a boolean value.\n     */\n    fileExists: function(path) {\n        return fs.stat(path).then(function(stats) {\n            return stats.isFile();\n        })[\"catch\"](function() {\n            return false;\n        });\n    },\n    fileExistsSync: function(path) {\n        if (fs.existsSync(path)) {\n            return fs.statSync(path).isFile();\n        } else {\n            return false;\n        }\n    },\n\n    /**\n     * Get files by patterns.\n     * @param  {String | Array} pattern The minimatch pattern.\n     * Patterns that starts with '!' in the array will be used\n     * to exclude paths.\n     * @param {Object} opts Extends the options of [eachDir](#eachDir-opts).\n     * **The `filter` property is fixed with the pattern, use `iter` instead**.\n     * Defaults:\n     * ```js\n     * {\n     *     all: false,\n     *\n     *     // The minimatch option object.\n     *     pmatch: {},\n     *\n     *     // It will be called after each match. It can also return\n     *     // a promise.\n     *     iter: (fileInfo, list) => list.push(fileInfo.path)\n     * }\n     * ```\n     * @return {Promise} Resolves the list array.\n     * @example\n     * ```js\n     * // Get all js files.\n     * nofs.glob(['**\\/*.js', '**\\/*.css']).then((paths) =>\n     *     console.log(paths)\n     * );\n     *\n     * // Exclude some files. \"a.js\" will be ignored.\n     * nofs.glob(['**\\/*.js', '!**\\/a.js']).then((paths) =>\n     *     console.log(paths)\n     * );\n     *\n     * // Custom the iterator. Append '/' to each directory path.\n     * nofs.glob('**\\/*.js', {\n     *     iter: (info, list) =>\n     *         list.push(info.isDir ? (info.path + '/') : info.path\n     * }).then((paths) =>\n     *     console.log(paths)\n     * );\n     * ```\n     */\n    glob: function(patterns, opts) {\n        var glob, iter, list, negateMath, pmatches, ref;\n        if (opts == null) {\n            opts = {};\n        }\n        _.defaults(opts, {\n            pmatch: {},\n            all: false,\n            iter: function(fileInfo, list) {\n                return list.push(fileInfo.path);\n            }\n        });\n        opts.pmatch.dot = opts.all;\n        if (_.isString(patterns)) {\n            patterns = [patterns];\n        }\n        patterns = patterns.map(npath.normalize);\n        list = [];\n        ref = nofs.pmatch.matchMultiple(patterns, opts.pmatch), pmatches = ref.pmatches, negateMath = ref.negateMath;\n        iter = opts.iter;\n        opts.iter = function(fileInfo) {\n            return iter(fileInfo, list);\n        };\n        glob = function(pm) {\n            var newOpts;\n            newOpts = _.defaults({\n                filter: function(fileInfo) {\n                    if (negateMath(fileInfo.path)) {\n                        return;\n                    }\n                    if (fileInfo.path === '.') {\n                        return pm.match('');\n                    }\n                    return pm.match(fileInfo.path);\n                },\n                searchFilter: function(fileInfo) {\n                    if (fileInfo.path === '.') {\n                        return true;\n                    }\n                    return pm.match(fileInfo.path, true);\n                }\n            }, opts);\n            return nofs.eachDir(nofs.pmatch.getPlainPath(pm), newOpts);\n        };\n        return pmatches.reduce(function(p, pm) {\n            return p.then(function() {\n                return glob(pm);\n            });\n        }, Promise.resolve()).then(function() {\n            return list;\n        });\n    },\n    globSync: function(patterns, opts) {\n        var glob, i, iter, len, list, negateMath, pm, pmatches, ref;\n        if (opts == null) {\n            opts = {};\n        }\n        _.defaults(opts, {\n            pmatch: {},\n            all: false,\n            iter: function(fileInfo, list) {\n                return list.push(fileInfo.path);\n            }\n        });\n        opts.pmatch.dot = opts.all;\n        if (_.isString(patterns)) {\n            patterns = [patterns];\n        }\n        patterns = patterns.map(npath.normalize);\n        list = [];\n        ref = nofs.pmatch.matchMultiple(patterns, opts.pmatch), pmatches = ref.pmatches, negateMath = ref.negateMath;\n        iter = opts.iter;\n        opts.iter = function(fileInfo) {\n            return iter(fileInfo, list);\n        };\n        glob = function(pm) {\n            var newOpts;\n            newOpts = _.defaults({\n                filter: function(fileInfo) {\n                    if (negateMath(fileInfo.path)) {\n                        return;\n                    }\n                    if (fileInfo.path === '.') {\n                        return pm.match('');\n                    }\n                    return pm.match(fileInfo.path);\n                },\n                searchFilter: function(fileInfo) {\n                    if (fileInfo.path === '.') {\n                        return true;\n                    }\n                    return pm.match(fileInfo.path, true);\n                }\n            }, opts);\n            return nofs.eachDirSync(nofs.pmatch.getPlainPath(pm), newOpts);\n        };\n        for (i = 0, len = pmatches.length; i < len; i++) {\n            pm = pmatches[i];\n            glob(pm);\n        }\n        return list;\n    },\n\n    /**\n     * Map file from a directory to another recursively with a\n     * callback.\n     * @param  {String}   from The root directory to start with.\n     * @param  {String}   to This directory can be a non-exists path.\n     * @param  {Object}   opts Extends the options of [eachDir](#eachDir-opts). But `cwd` is\n     * fixed with the same as the `from` parameter. Defaults:\n     * ```js\n     * {\n     *     // It will be called with each path. The callback can return\n     *     // a `Promise` to keep the async sequence go on.\n     *     iter: (src, dest, fileInfo) => Promise | Any,\n     *\n     *     // When isMapContent is true, and the current is a file.\n     *     iter: (content, src, dest, fileInfo) => Promise | Any,\n     *\n     *     // When isMapContent is true, and the current is a folder.\n     *     iter: (mode, src, dest, fileInfo) => Promise | Any,\n     *\n     *     isMapContent: false,\n     *\n     *     isIterFileOnly: true\n     * }\n     * ```\n     * @return {Promise} Resolves a tree object.\n     * @example\n     * ```js\n     * nofs.mapDir('from', 'to', {\n     *     iter: (src, dest, info) =>\n     *         console.log(src, dest, info)\n     * });\n     * ```\n     * @example\n     * ```js\n     * // Copy and add license header for each files\n     * // from a folder to another.\n     * nofs.mapDir('from', 'to', {\n     *     ismMapContent: true,\n     *     iter: (content) =>\n     *         'License MIT\\n' + content\n     * });\n     * ```\n     */\n    mapDir: function(from, to, opts) {\n        var iter, pm;\n        if (opts == null) {\n            opts = {};\n        }\n\n        _.defaults(opts, {\n            iter: _.id,\n            isIterFileOnly: true,\n            isMapContent: false\n        });\n\n        if (pm = nofs.pmatch.isPmatch(from)) {\n            from = nofs.pmatch.getPlainPath(pm);\n            pm = npath.relative(from, pm.pattern);\n            opts.filter = pm;\n        }\n        opts.cwd = from;\n        iter = opts.iter;\n        opts.iter = function(fileInfo) {\n            var dest, src;\n            src = npath.join(from, fileInfo.path);\n            dest = npath.join(to, fileInfo.path);\n\n            if (opts.isMapContent) {\n                if (fileInfo.isDir) {\n                    return iter(fileInfo.stats.mode, src, dest, fileInfo)\n                    .then(function (mode) {\n                        return nofs.mkdirs(dest, mode);\n                    });\n                } else {\n                    return fs.readFile(src).then(function (content) {\n                        return iter(content, src, dest, fileInfo);\n                    }).then(function (content) {\n                        return nofs.outputFile(dest, content, { mode: fileInfo.mode });\n                    });\n                }\n            } else {\n                return iter(src, dest, fileInfo);\n            }\n        };\n        return nofs.eachDir('', opts);\n    },\n    mapDirSync: function(from, to, opts) {\n        var iter, pm;\n        if (opts == null) {\n            opts = {};\n        }\n\n        _.defaults(opts, {\n            iter: _.id,\n            isIterFileOnly: true,\n            isMapContent: false\n        });\n\n        if (pm = nofs.pmatch.isPmatch(from)) {\n            from = nofs.pmatch.getPlainPath(pm);\n            pm = npath.relative(from, pm.pattern);\n            opts.filter = pm;\n        }\n        opts.cwd = from;\n        iter = opts.iter;\n        opts.iter = function(fileInfo) {\n            var dest, src;\n            src = npath.join(from, fileInfo.path);\n            dest = npath.join(to, fileInfo.path);\n\n            if (opts.isMapContent) {\n                if (fileInfo.isDir) {\n                    var mode = iter(fileInfo.stats.mode, src, dest, fileInfo);\n                    nofs.mkdirsSync(dest, mode);\n                } else {\n                    var content = fs.readFileSync(src);\n                    content = iter(content, src, dest, fileInfo);\n                    nofs.outputFileSync(dest, content, { mode: fileInfo.mode });\n                }\n            } else {\n                return iter(src, dest, fileInfo);\n            }\n        };\n        return nofs.eachDirSync('', opts);\n    },\n\n    /**\n     * Recursively create directory path, like `mkdir -p`.\n     * @param  {String} path\n     * @param  {String} mode Defaults: `0o777 & ~process.umask()`\n     * @return {Promise}\n     */\n    mkdirs: function(path, mode) {\n        var makedir;\n        if (mode == null) {\n            mode = 0x1ff & ~process.umask();\n        }\n        makedir = function(path) {\n            // ys TODO:\n            // Sometimes I think this async operation is\n            // useless, since during the next process tick, the\n            // dir may be created.\n            // We may use dirExistsSync to avoid this bug, but\n            // for the sake of pure async, I leave it still.\n            return nofs.dirExists(path).then(function(exists) {\n                var parentPath;\n                if (exists) {\n                    return Promise.resolve();\n                } else {\n                    parentPath = npath.dirname(path);\n                    return makedir(parentPath).then(function() {\n                        return fs.mkdir(path, mode)[\"catch\"](function(err) {\n                            if (err.code !== 'EEXIST') {\n                                return Promise.reject(err);\n                            }\n                        });\n                    });\n                }\n            });\n        };\n        return makedir(path);\n    },\n    mkdirsSync: function(path, mode) {\n        var makedir;\n        if (mode == null) {\n            mode = 0x1ff & ~process.umask();\n        }\n        makedir = function(path) {\n            var parentPath;\n            if (!nofs.dirExistsSync(path)) {\n                parentPath = npath.dirname(path);\n                makedir(parentPath);\n                return fs.mkdirSync(path, mode);\n            }\n        };\n        return makedir(path);\n    },\n\n    /**\n     * Moves a file or directory. Also works between partitions.\n     * Behaves like the Unix `mv`.\n     * @param  {String} from Source path.\n     * @param  {String} to   Destination path.\n     * @param  {Object} opts Defaults:\n     * ```js\n     * {\n     *     isForce: false,\n     *     isFollowLink: false\n     * }\n     * ```\n     * @return {Promise} It will resolve a boolean value which indicates\n     * whether this action is taken between two partitions.\n     */\n    move: function(from, to, opts) {\n        var moveFile;\n        if (opts == null) {\n            opts = {};\n        }\n        _.defaults(opts, {\n            isForce: false,\n            isFollowLink: false\n        });\n        moveFile = function(src, dest) {\n            if (opts.isForce) {\n                return fs.rename(src, dest);\n            } else {\n                return fs.link(src, dest).then(function() {\n                    return fs.unlink(src);\n                });\n            }\n        };\n        return fs.stat(from).then(function(stats) {\n            return nofs.dirExists(to).then(function(exists) {\n                if (exists) {\n                    nofs.mkdirs(to);\n                    return to = npath.join(to, npath.basename(from));\n                } else {\n                    return nofs.mkdirs(npath.dirname(to));\n                }\n            }).then(function() {\n                if (stats.isDirectory()) {\n                    return fs.rename(from, to);\n                } else {\n                    return moveFile(from, to);\n                }\n            });\n        })[\"catch\"](function(err) {\n            if (err.code === 'EXDEV') {\n                return nofs.copy(from, to, opts).then(function() {\n                    return nofs.remove(from);\n                });\n            } else {\n                return Promise.reject(err);\n            }\n        });\n    },\n    moveSync: function(from, to, opts) {\n        var err, error, moveFile, stats;\n        if (opts == null) {\n            opts = {};\n        }\n        _.defaults(opts, {\n            isForce: false\n        });\n        moveFile = function(src, dest) {\n            if (opts.isForce) {\n                fs.renameSync(src, dest);\n            } else {\n                fs.linkSync(src, dest)\n                fs.unlinkSync(src);\n            }\n        };\n        try {\n            if (nofs.dirExistsSync(to)) {\n                nofs.mkdirsSync(to);\n                to = npath.join(to, npath.basename(from));\n            } else {\n                nofs.mkdirsSync(npath.dirname(to));\n            }\n            stats = fs.statSync(from);\n            if (stats.isDirectory()) {\n                return fs.renameSync(from, to);\n            } else {\n                return moveFile(from, to);\n            }\n        } catch (error) {\n            err = error;\n            if (err.code === 'EXDEV') {\n                nofs.copySync(from, to, opts);\n                return nofs.removeSync(from);\n            } else {\n                throw err;\n            }\n        }\n    },\n\n    /**\n     * Almost the same as `writeFile`, except that if its parent\n     * directories do not exist, they will be created.\n     * @param  {String} path\n     * @param  {String | Buffer} data\n     * @param  {String | Object} opts <a id=\"outputFile-opts\"></a>\n     * Same with the [writeFile](#writeFile-opts).\n     * @return {Promise}\n     */\n    outputFile: function(path, data, opts) {\n        if (opts == null) {\n            opts = {};\n        }\n        return nofs.fileExists(path).then(function(exists) {\n            var dir;\n            if (exists) {\n                return nofs.writeFile(path, data, opts);\n            } else {\n                dir = npath.dirname(path);\n                return nofs.mkdirs(dir, opts.mode).then(function() {\n                    return nofs.writeFile(path, data, opts);\n                });\n            }\n        });\n    },\n    outputFileSync: function(path, data, opts) {\n        var dir;\n        if (opts == null) {\n            opts = {};\n        }\n        if (nofs.fileExistsSync(path)) {\n            return nofs.writeFileSync(path, data, opts);\n        } else {\n            dir = npath.dirname(path);\n            nofs.mkdirsSync(dir, opts.mode);\n            return nofs.writeFileSync(path, data, opts);\n        }\n    },\n\n    /**\n     * Write a object to a file, if its parent directory doesn't\n     * exists, it will be created.\n     * @param  {String} path\n     * @param  {Any} obj  The data object to save.\n     * @param  {Object | String} opts Extends the options of [outputFile](#outputFile-opts).\n     * Defaults:\n     * ```js\n     * {\n     *     replacer: null,\n     *     space: null\n     * }\n     * ```\n     * @return {Promise}\n     */\n    outputJson: function(path, obj, opts) {\n        var err, error, str;\n        if (opts == null) {\n            opts = {};\n        }\n        if (_.isString(opts)) {\n            opts = {\n                encoding: opts\n            };\n        }\n        try {\n            str = JSON.stringify(obj, opts.replacer, opts.space);\n            str += '\\n';\n        } catch (error) {\n            err = error;\n            return Promise.reject(err);\n        }\n        return nofs.outputFile(path, str, opts);\n    },\n    outputJsonSync: function(path, obj, opts) {\n        var str;\n        if (opts == null) {\n            opts = {};\n        }\n        if (_.isString(opts)) {\n            opts = {\n                encoding: opts\n            };\n        }\n        str = JSON.stringify(obj, opts.replacer, opts.space);\n        str += '\\n';\n        return nofs.outputFileSync(path, str, opts);\n    },\n\n    /**\n     * The path module nofs is using.\n     * It's the native [io.js](iojs.org) path lib.\n     * nofs will force all the path separators to `/`,\n     * such as `C:\\a\\b` will be transformed to `C:/a/b`.\n     * @type {Object}\n     */\n    path: npath,\n\n    /**\n     * The `minimatch` lib. It has two extra methods:\n     * - `isPmatch(String | Object) -> Pmatch | undefined`\n     *     It helps to detect if a string or an object is a minimatch.\n     *\n     * - `getPlainPath(Pmatch) -> String`\n     *     Helps to get the plain root path of a pattern. Such as `src/js/*.js`\n     *     will get `src/js`\n     *\n     * [Documentation](https://github.com/isaacs/minimatch)\n     *\n     * [Offline Documentation](?gotoDoc=minimatch/readme.md)\n     * @example\n     * ```js\n     * nofs.pmatch('a/b/c.js', '**\\/*.js');\n     * // output => true\n     * nofs.pmatch.isPmatch('test*');\n     * // output => true\n     * nofs.pmatch.isPmatch('test/b');\n     * // output => false\n     * ```\n     */\n    pmatch: require('./pmatch'),\n\n    /**\n     * What promise this lib is using.\n     * @type {Promise}\n     */\n    Promise: Promise,\n\n    /**\n     * Same as the [`yaku/lib/utils`](https://github.com/ysmood/yaku#utils).\n     * @type {Object}\n     */\n    PromiseUtils: _.PromiseUtils,\n\n    /**\n     * Read A Json file and parse it to a object.\n     * @param  {String} path\n     * @param  {Object | String} opts Same with the native `nofs.readFile`.\n     * @return {Promise} Resolves a parsed object.\n     * @example\n     * ```js\n     * nofs.readJson('a.json').then((obj) =>\n     *     console.log(obj.name, obj.age)\n     * );\n     * ```\n     */\n    readJson: function(path, opts) {\n        if (opts == null) {\n            opts = {};\n        }\n        return fs.readFile(path, opts).then(function(data) {\n            var err, error;\n            try {\n                return JSON.parse(data + '');\n            } catch (error) {\n                err = error;\n                return Promise.reject(err);\n            }\n        });\n    },\n    readJsonSync: function(path, opts) {\n        var data;\n        if (opts == null) {\n            opts = {};\n        }\n        data = fs.readFileSync(path, opts);\n        return JSON.parse(data + '');\n    },\n\n    /**\n     * Walk through directory recursively with a iterator.\n     * @param  {String}   path\n     * @param  {Object}   opts Extends the options of [eachDir](#eachDir-opts),\n     * with some extra options:\n     * ```js\n     * {\n     *     iter: (prev, path, isDir, stats) -> Promise | Any,\n     *\n     *     // The init value of the walk.\n     *     init: undefined,\n     *\n     *     isIterFileOnly: true\n     * }\n     * ```\n     * @return {Promise} Final resolved value.\n     * @example\n     * ```js\n     * // Concat all files.\n     * nofs.reduceDir('dir/path', {\n     *     init: '',\n     *     iter: (val, { path }) =>\n     *         nofs.readFile(path).then((str) =>\n     *             val += str + '\\n'\n     *         )\n     * }).then((ret) =>\n     *     console.log(ret)\n     * );\n     * ```\n     */\n    reduceDir: function(path, opts) {\n        var iter, prev;\n        if (opts == null) {\n            opts = {};\n        }\n        _.defaults(opts, {\n            isIterFileOnly: true\n        });\n        prev = Promise.resolve(opts.init);\n        iter = opts.iter;\n        opts.iter = function(fileInfo) {\n            return prev = prev.then(function(val) {\n                val = iter(val, fileInfo);\n                if (!val || !val.then) {\n                    return Promise.resolve(val);\n                }\n            });\n        };\n        return nofs.eachDir(path, opts).then(function() {\n            return prev;\n        });\n    },\n    reduceDirSync: function(path, opts) {\n        var iter, prev;\n        if (opts == null) {\n            opts = {};\n        }\n        _.defaults(opts, {\n            isIterFileOnly: true\n        });\n        prev = opts.init;\n        iter = opts.iter;\n        opts.iter = function(fileInfo) {\n            return prev = iter(prev, fileInfo);\n        };\n        nofs.eachDirSync(path, opts);\n        return prev;\n    },\n\n    /**\n     * Remove a file or directory peacefully, same with the `rm -rf`.\n     * @param  {String} path\n     * @param {Object} opts Extends the options of [eachDir](#eachDir-opts). But\n     * the `isReverse` is fixed with `true`. Defaults:\n     * ```js\n     * { isFollowLink: false }\n     * ```\n     * @return {Promise}\n     */\n    remove: function(path, opts) {\n        var removeOpts;\n        if (opts == null) {\n            opts = {};\n        }\n        _.defaults(opts, {\n            isFollowLink: false\n        });\n        opts.isReverse = true;\n        removeOpts = _.extend({\n            iter: function(arg) {\n                var isDir, path;\n                path = arg.path, isDir = arg.isDir;\n                if (isDir) {\n                    return fs.rmdir(path);\n                } else {\n                    return fs.unlink(path);\n                }\n            }\n        }, opts, {\n            isAutoPmatch: false\n        });\n        opts.iter = function(arg) {\n            var isDir, path;\n            path = arg.path, isDir = arg.isDir;\n            if (isDir) {\n                return fs.rmdir(path)[\"catch\"](function(err) {\n                    if (err.code === 'ENOTEMPTY') {\n                        return nofs.eachDir(path, removeOpts);\n                    }\n                    return Promise.reject(err);\n                });\n            } else {\n                return fs.unlink(path);\n            }\n        };\n        return nofs.eachDir(path, opts);\n    },\n    removeSync: function(path, opts) {\n        var removeOpts;\n        if (opts == null) {\n            opts = {};\n        }\n        _.defaults(opts, {\n            isFollowLink: false\n        });\n        opts.isReverse = true;\n        removeOpts = _.extend({\n            iter: function(arg) {\n                var isDir, path;\n                path = arg.path, isDir = arg.isDir;\n                if (isDir) {\n                    return fs.rmdirSync(path);\n                } else {\n                    return fs.unlinkSync(path);\n                }\n            }\n        }, opts, {\n            isAutoPmatch: false\n        });\n        opts.iter = function(arg) {\n            var err, error, isDir, path;\n            path = arg.path, isDir = arg.isDir;\n            if (isDir) {\n                try {\n                    return fs.rmdirSync(path);\n                } catch (error) {\n                    err = error;\n                    if (err.code === 'ENOTEMPTY') {\n                        return nofs.eachDirSync(path, removeOpts);\n                    }\n                    return Promise.reject(err);\n                }\n            } else {\n                return fs.unlinkSync(path);\n            }\n        };\n        return nofs.eachDirSync(path, opts);\n    },\n\n    /**\n     * Change file access and modification times.\n     * If the file does not exist, it is created.\n     * @param  {String} path\n     * @param  {Object} opts Default:\n     * ```js\n     * {\n     *     atime: Date.now(),\n     *     mtime: Date.now(),\n     *     mode: undefined\n     * }\n     * ```\n     * @return {Promise} If new file created, resolves true.\n     */\n    touch: function(path, opts) {\n        var now;\n        if (opts == null) {\n            opts = {};\n        }\n        now = new Date;\n        _.defaults(opts, {\n            atime: now,\n            mtime: now\n        });\n        return nofs.fileExists(path).then(function(exists) {\n            var p;\n            if (exists) {\n                p = Promise.resolve();\n            } else {\n                p = nofs.outputFile(path, Buffer.from(''), opts);\n            } \n            return p.then(function () {\n                return fs.utimes(path, opts.atime, opts.mtime);\n            }).then(function () {\n                return !exists;\n            });\n        });\n    },\n    touchSync: function(path, opts) {\n        var exists, now;\n        if (opts == null) {\n            opts = {};\n        }\n        now = new Date;\n        _.defaults(opts, {\n            atime: now,\n            mtime: now\n        });\n        exists = nofs.fileExistsSync(path);\n        if (!exists) {\n            nofs.outputFileSync(path, Buffer.from(''), opts);\n        }\n        fs.utimesSync(path, opts.atime, opts.mtime);\n        return !exists;\n    },\n\n    /**\n     * <a id=\"writeFile-opts\"></a>\n     * Watch a file. If the file changes, the handler will be invoked.\n     * You can change the polling interval by using `process.env.pollingWatch`.\n     * Use `process.env.watchPersistent = 'off'` to disable the persistent.\n     * Why not use `nofs.watch`? Because `nofs.watch` is unstable on some file\n     * systems, such as Samba or OSX.\n     * @param  {String}   path    The file path\n     * @param  {Object} opts Defaults:\n     * ```js\n     * {\n     *     handler: (path, curr, prev, isDeletion) => {},\n     *\n     *     // Auto unwatch the file while file deletion.\n     *     autoUnwatch: true,\n     *\n     *     persistent: process.env.watchPersistent != 'off',\n     *     interval: +process.env.pollingWatch || 300\n     * }\n     * ```\n     * @return {Promise} It resolves the `StatWatcher` object:\n     * ```js\n     * {\n     *     path,\n     *     handler\n     * }\n     * ```\n     * @example\n     * ```js\n     * process.env.watchPersistent = 'off'\n     * nofs.watchPath('a.js', {\n     *     handler: (path, curr, prev, isDeletion) => {\n     *         if (curr.mtime !== prev.mtime)\n     *             console.log(path);\n     *     }\n     * }).then((watcher) =>\n     *     nofs.unwatchFile(watcher.path, watcher.handler)\n     * );\n     * ```\n     */\n    watchPath: function(path, opts) {\n        var handler, watcher;\n        if (opts == null) {\n            opts = {};\n        }\n        _.defaults(opts, {\n            autoUnwatch: true,\n            persistent: process.env.watchPersistent !== 'off',\n            interval: +process.env.pollingWatch || 300\n        });\n        handler = function(curr, prev) {\n            var isDeletion;\n            isDeletion = curr.mtime.getTime() === 0;\n            opts.handler(path, curr, prev, isDeletion);\n            if (opts.autoUnwatch && isDeletion) {\n                return fs.unwatchFile(path, handler);\n            }\n        };\n        watcher = fs.watchFile(path, opts, handler);\n        return Promise.resolve(_.extend(watcher, {\n            path: path,\n            handler: handler\n        }));\n    },\n\n    /**\n     * Watch files, when file changes, the handler will be invoked.\n     * It is build on the top of `nofs.watchPath`.\n     * @param  {Array} patterns String array with minimatch syntax.\n     * Such as `['*\\/**.css', 'lib\\/**\\/*.js']`.\n     * @param  {Object} opts Same as the `nofs.watchPath`.\n     * @return {Promise} It contains the wrapped watch listeners.\n     * @example\n     * ```js\n     * nofs.watchFiles('*.js', handler: (path, curr, prev, isDeletion) =>\n     *     console.log (path)\n     * );\n     * ```\n     */\n    watchFiles: function(patterns, opts) {\n        if (opts == null) {\n            opts = {};\n        }\n        return nofs.glob(patterns).then(function(paths) {\n            return Promise.all(paths.map(function(path) {\n                return nofs.watchPath(path, opts);\n            }));\n        });\n    },\n\n    /**\n     * Watch directory and all the files in it.\n     * It supports three types of change: create, modify, move, delete.\n     * By default, `move` event is disabled.\n     * It is build on the top of `nofs.watchPath`.\n     * @param {String} root\n     * @param  {Object} opts Defaults:\n     * ```js\n     * {\n     *     handler: (type, path, oldPath, stats, oldStats) => {},\n     *\n     *     patterns: '**', // minimatch, string or array\n     *\n     *     // Whether to watch POSIX hidden file.\n     *     all: false,\n     *\n     *     // The minimatch options.\n     *     pmatch: {},\n     *\n     *     isEnableMoveEvent: false\n     * }\n     * ```\n     * @return {Promise} Resolves a object that keys are paths,\n     * values are listeners.\n     * @example\n     * ```js\n     * // Only current folder, and only watch js and css file.\n     * nofs.watchDir('lib', {\n     *  pattern: '*.+(js|css)',\n     *  handler: (type, path, oldPath, stats, oldStats) =>\n     *      console.log(type, path, stats.isDirectory(), oldStats.isDirectory())\n     * });\n     * ```\n     */\n    watchDir: function(root, opts) {\n        var dirHandler, fileHandler, isSameFile, match, negateMath, ref, watchedList;\n        if (opts == null) {\n            opts = {};\n        }\n\n        _.defaults(opts, {\n            patterns: '**',\n            pmatch: {},\n            all: false,\n            error: function(err) {\n                try {\n                    return console.error(err);\n                } catch (err) {}\n            }\n        });\n\n        opts.pmatch.dot = opts.all;\n        if (_.isString(opts.patterns)) {\n            opts.patterns = [opts.patterns];\n        }\n\n        opts.patterns = opts.patterns.map(function(p) {\n            if (p[0] === '!') {\n                return '!' + npath.join(root, p.slice(1));\n            } else {\n                return npath.join(root, p);\n            }\n        });\n        ref = nofs.pmatch.matchMultiple(opts.patterns, opts.pmatch), match = ref.match, negateMath = ref.negateMath;\n\n        watchedList = {};\n\n        // TODO: move event\n        isSameFile = function(statsA, statsB) {\n            // On Unix just \"ino\" will do the trick, but on Windows\n            // \"ino\" is always zero.\n            if (statsA.ctime.ino !== 0 && statsA.ctime.ino === statsB.ctime.ino) {\n                return true;\n            }\n\n            // Since \"size\" for Windows is always zero, and the unit of \"time\"\n            // is second, the code below is not reliable.\n            return statsA.mtime.getTime() === statsB.mtime.getTime() && statsA.ctime.getTime() === statsB.ctime.getTime() && statsA.size === statsB.size;\n        };\n\n        fileHandler = function(path, curr, prev, isDelete) {\n            if (isDelete) {\n                opts.handler('delete', path, null, curr, prev);\n                return delete watchedList[path];\n            } else {\n                return opts.handler('modify', path, null, curr, prev);\n            }\n        };\n\n        dirHandler = function(dir, curr, prev, isDelete) {\n            // Possible Event Order\n            // 1. modify event: file modify.\n            // 2. delete event: file delete -> parent modify.\n            // 3. create event: parent modify -> file create.\n            // 4.   move event: file delete -> parent modify -> file create.\n\n            if (isDelete) {\n                opts.handler('delete', dir, null, curr, prev);\n                delete watchedList[dir];\n                return;\n            }\n\n            // Prevent high frequency concurrent fs changes,\n            // we should to use Sync function here. But for\n            // now if we don't need `move` event, everything is OK.\n            return nofs.eachDir(dir, {\n                all: opts.all,\n                iter: function(fileInfo) {\n                    var path;\n                    path = fileInfo.path;\n                    if (watchedList[path]) {\n                        return;\n                    }\n                    if (fileInfo.isDir) {\n                        if (curr) {\n                            opts.handler('create', path, null, fileInfo.stats);\n                        }\n                        return nofs.watchPath(path, {\n                            handler: dirHandler\n                        }).then(function(listener) {\n                            if (listener) {\n                                return watchedList[path] = listener;\n                            }\n                        });\n                    } else if (!negateMath(path) && match(path)) {\n                        if (curr) {\n                            opts.handler('create', path, null, fileInfo.stats);\n                        }\n                        return nofs.watchPath(path, {\n                            handler: fileHandler\n                        }).then(function(listener) {\n                            if (listener) {\n                                return watchedList[path] = listener;\n                            }\n                        });\n                    }\n                }\n            });\n        };\n\n        return dirHandler(root).then(function() {\n            return watchedList;\n        });\n    },\n\n    /**\n     * A `writeFile` shim for `< Node v0.10`.\n     * @param  {String} path\n     * @param  {String | Buffer} data\n     * @param  {String | Object} opts\n     * @return {Promise}\n     */\n    writeFile: function(path, data, opts) {\n        var encoding, flag, mode;\n        if (opts == null) {\n            opts = {};\n        }\n        switch (typeof opts) {\n            case 'string':\n                encoding = opts;\n                break;\n            case 'object':\n                encoding = opts.encoding, flag = opts.flag, mode = opts.mode;\n                break;\n            default:\n                return Promise.reject(new TypeError('Bad arguments'));\n        }\n        if (flag == null) {\n            flag = 'w';\n        }\n        if (mode == null) {\n            mode = 0x1b6;\n        }\n        return fs.open(path, flag, mode).then(function(fd) {\n            var buf, pos;\n            buf = _.encodeNonBuffer(data, encoding);\n            pos = flag.indexOf('a') > -1 ? null : 0;\n            return fs.write(fd, buf, 0, buf.length, pos).then(function() {\n                return fs.close(fd);\n            });\n        });\n    },\n    writeFileSync: function(path, data, opts) {\n        var buf, encoding, fd, flag, mode, pos;\n        if (opts == null) {\n            opts = {};\n        }\n        switch (typeof opts) {\n            case 'string':\n                encoding = opts;\n                break;\n            case 'object':\n                encoding = opts.encoding, flag = opts.flag, mode = opts.mode;\n                break;\n            default:\n                throw new TypeError('Bad arguments');\n        }\n        if (flag == null) {\n            flag = 'w';\n        }\n        if (mode == null) {\n            mode = 0x1b6;\n        }\n        fd = fs.openSync(path, flag, mode);\n        buf = _.encodeNonBuffer(data, encoding);\n        pos = flag.indexOf('a') > -1 ? null : 0;\n        fs.writeSync(fd, buf, 0, buf.length, pos);\n        return fs.closeSync(fd);\n    }\n});\n\n(function() {\n    var k, name, results;\n    results = [];\n    for (k in nofs) {\n        if (k.slice(-4) === 'Sync') {\n            name = k.slice(0, -4);\n            fs[name] = _.PromiseUtils.callbackify(nofs[name]);\n        }\n        results.push(fs[k] = nofs[k]);\n    }\n    return results;\n})();\n\nrequire('./alias')(fs);\n\nmodule.exports = fs;\n"]}