Async resolve a files path using nodes module resolution.

@param {string} dir - the directory to look in.
@param {string} file - the file to find.
@return {Promise<string>}
1418
function resolveFile (dir, file) {
  return new Promise((resolve, reject) => {
    resolver.resolve({}, dir, file, (err, result) => {
      if (err) reject(err)
      else resolve(result)
    })
  })
}
1122616
function readPromise(file, defaultContent){
	return new Promise(function(resolve, reject){
		if ( exists(file) ) {
			fs.readFile(file, 'utf-8', (err, data) => err ? reject(err) : resolve(data));
		}else{
			defaultContent === undefined ? reject('file not found: ' + file) : resolve(defaultContent);
		}
	});
}
534888
async function getFiles(path) {
  return new Promise((resolve, reject) => {
    glob(path, (error, files) => (error ? reject(error) : resolve(files)));
  });
}
165502
function mkdir(file, ignorePoint) {
	let dirs = file.split(/[/\\]/);
	if(!ignorePoint && dirs[dirs.length - 1].indexOf('.') >= 0){
		dirs.length = dirs.length -1;
	}

	let path = '';
	for(let i = 0; i < dirs.length; i++){
		if (i==0) {
			path = dirs[i] + '/' ;
		}else{
			path += dirs[i] + '/';
		}

		if (!fs.existsSync(path)) {
			fs.mkdirSync(path, err=>console.error(err))
		}
	}
}
629451
function resolve() {
            resolvePath(path, function (err, _resolvedPath) {
                if (err) {
                    if (err.code !== "ENOENT") {
                        return error(err);
                    }
                    // If checkSymlinks is on we'll get an ENOENT when creating a new file.
                    // In that case, just resolve the parent path and go from there.
                    resolvePath(dirname(path), function (err, dir) {
                        if (err) return error(err);
                        resolvedPath = join(dir, basename(path));
                        createTempFile();
                    });
                    return;
                }
                
                resolvedPath = _resolvedPath;
                createTempFile();
            });
        }
785532
function globPromise (file) {
    return new Promise((resolve, reject) => {
      glob(file, (err, files) => {
        if (err) {
          reject(err)
        } else {
          resolve(files)
        }
      })
    })
  }
1167751
function filePath(file, dir) {
    return path.normalize(path.join(dir || __dirname, file));
}
253368
function _libraryFiles(directory) {
	return new Promise((fulfill) => {
		const files = [];
		klaw(directory)
			.on('data', (item) => {
				const relativePath = path.relative(directory, item.path);
				files.push(relativePath);
			})
			.on('end', () => {
				fulfill(files);
			});
	});
}
1054083
function resolveFile(cwd, dir, filename) {
	dir = pathJoin(cwd, dir);

	var filepath = pathJoin(dir, filename);
	var stat = fsStatSync(filepath);

	return stat && {
		cwd: cwd,
		dir: dir,
		path: filepath
	};
}
350177
async function makeDir(dir) {
    const res = await makePromise(fs.mkdir, dir, dir)
    return res
}
1082707
async function make(dir) {
    try {
        const res = await makeDir(dir)
        return res
    } catch (err) {
        if (/ENOENT/.test(err.message)) {
            const parentDir = dirname(dir)
            await make(parentDir)
            const res2 = await make(dir)
            return res2
        }
        throw err
    }
}
655187
function resolveDir(directories)
{
  var directoriesAbsPath;

  if (typeOf(directories) == 'array')
  {
    directoriesAbsPath = directories.map(function(d)
    {
      return path.resolve(d);
    }).join('|');
  }
  else
  {
    directoriesAbsPath = path.resolve(directories);
  }

  return directoriesAbsPath;
}
1252609
async function getFileList(dir, fileList) {
  return new Promise(async function (resolve, reject) {  
  fileList = fileList || [];
  var filesIndex = await io.getFiles(dir, null);   
  var files = io.absoluteFiles(filesIndex);
  files.forEach(function (file) {
    fileList.push(file);
  });
  resolve(fileList);
});
}
305043
function (file) {
	var folder = path.dirname(file) + '/' + path.basename( file, '.json' );
	return fs.existsSync(folder) && isDir(folder) ? folder : false;
}
871722
function resolveModModFile(resolver, request, callback){
  var joined = path.join(request.request, request.request);
  return resolver.doResolve("file", {
    path: request.path,
    request: joined,
    query: request.query
  }, callback, true);
}
875601
function ( file ) {
			var resolved;
			var expanded = grunt.file.expand( file )[0];

			if ( !expanded ) {
				resolved = require.resolve( file );

			} else {
				resolved = "./" + expanded;
			}

			return resolved;
		}
537075
function (dirname) {
        return new Promise((resolve, reject) => {
            fs.mkdir(dirname, (err) => {
                if (err) {
                    reject(err);
                }
                else {
                    resolve(dirname);
                }
            });
        });
    }