获取文件内容
@param {String} 文件名
@param {Function} 回调函数
550458
function getFile(fn) {
	return new Promise((a, b) => _fs2.default.readFile(fn, 'utf-8', (e, d) => e ? b(e) : a(d)));
}
889237
function initFile (file) {
  if (!file.oss) {
    file.oss = {};
    file.oss.headers = {};
    file.oss.path = file.relative.replace(/\\/g, '/');
  }
  return file;
}
24226
function fileContent(file, dontIgnoreExports) {
    return fs.readFileSync(file, 'UTF-8').split(/\r?\n/)
        .map(line => {
            if (/(=|^|\s)require\(['"]/.test(line)
                || (!dontIgnoreExports && /^\s*(module\.)?exports\s+=/.test(line))
            ) {
                return '// ' + line;
            }

            return line.replace(OPTI_ENUM_REPLACE_REG, optiEnumReplaceFn);
        })
        .join('\n');
}
835954
function parseFile(fs, file, type) {
    var filepath = file.getPath();
    var parser = file.getParser();

    if (!parser) {
        return Promise.reject(
            error.FileNotParsableError({
                filename: filepath
            })
        );
    }

    return fs.readAsString(filepath)
    .then(function(content) {
        if (type === 'readme') {
            return parser.parseReadme(content);
        } else if (type === 'glossary') {
            return parser.parseGlossary(content);
        } else if (type === 'summary') {
            return parser.parseSummary(content);
        } else if (type === 'langs') {
            return parser.parseLanguages(content);
        } else {
            throw new Error('Parsing invalid type "' + type + '"');
        }
    })
    .then(function(result) {
        return [
            file,
            result
        ];
    });
}
39156
function (/*String*/path, /*String?*/encoding) {
        if (encoding === 'utf-8') {
            encoding = 'utf8';
        }
        if (!encoding) {
            encoding = 'utf8';
        }

        return fs.readFileSync(path, encoding);
    }
1018848
async function getFileSize(file) {
  const data = await readFileAsync(file, 'utf-8');
  return {
    fileSize: fileSize(Buffer.byteLength(data)),
    gzipSize: fileSize(await gzipSize(data))
  };
}
932496
function write(file, data) {
  writeFileSync(file, data);

  console.log(
    `✓ ${relative(__dirname + "/../", file)} (${bytes(statSync(file).size)})`
  );
}
392304
function readFile (file) {
    if (!isFileRegistered(file)) { return undefined; }

    fileRegistry[file].content = gruntIsFile(file) ? gruntRead(file) + '\x0A' : '';
}
544269
function parse(file) {
  var rules = {};

  file
    .split(/\n/m)
    .filter(function (line) {
      return (/^\/\//).test(line) ? null : line;
    })
    .map(function (line) {
      return process(line.split("."), rules);
    });

  return rules;
}
429308
function copyFile(src, dest) {
      var content = fs.readFileSync(src, 'binary');
      fs.writeFileSync(dest, content, 'binary');
    }
915876
function parseFile(dir, filename) {
  const filePath = path.join(dir, filename);
  const fileStat = fs.statSync(filePath);
  const fileExt = path.extname(filename);

  return {
    path: filePath,
    stat: fileStat,
    ext: fileExt
  };
}
1282581
function(file, content, callback) {
			fs.writeFile(file, content, 'ascii', function(err) {
				callback(err ? err : null);
			});
		}
1050939
public void validateFile(MultipartFile file, long maxLength, String[] allowExtName) {

        if (file.isEmpty()) {
            throw new FieldException("file", "您没有上传文件", null);
        }

        // 文件大小
        if (file.getSize() < 0 || file.getSize() > maxLength) {

            throw new FieldException("file", "文件不允许超过" + String.valueOf(maxLength), null);
        }

        //
        // 处理不选择文件点击上传时，也会有MultipartFile对象，在此进行过滤
        //
        String filename = file.getOriginalFilename();

        if (filename == "") {
            throw new FieldException("file", "文件名不能为空", null);
        }

        //
        // 文件名后缀
        //
        /*
        if (filename.contains(".")) {

            String extName = filename.substring(filename.lastIndexOf(".")).toLowerCase();
            if (allowExtName == null || allowExtName.length == 0 || Arrays.binarySearch(allowExtName, extName) >= 0) {
            } else {
                //throw new FieldException("file", "文件后缀不允许", null);
            }
        } else {
            //throw new FieldException("file", "文件后缀不允许", null);
        }*/
    }
1180978
function parseFile(filePath, encoding, callback) {
	return fs.readFile(filePath, encoding, function(err, fileString) {
		if (err) {
			return callback(err);
		}

		fileString = expandIncludes(fileString, path.dirname(filePath));

		return parse(fileString, callback);
	});
}
1309666
function readFile(file) {
    try {
        file = require(path.relative(__dirname, file));
    } catch (err) {
        return err;
    }

    return file;
}
161330
function (files) {
  return files.reduce(function (filesMap, file) {
    let fileName = path.parse(file).name;
    filesMap[fileName] = readFile(file, 'utf8');

    return filesMap;
  }, {});
}
754604
function overwriteFile (filename, contents) {
    // log.cyan ('Overwriting → ' + filename.yellow)
    fs.closeSync (fs.openSync (filename, 'a'));
    fs.truncateSync (filename)
    fs.writeFileSync (filename, contents)
}