Read a file.
@param {string} path The path to the file to read.
354097
async function read(path) {
  const rs = createReadStream(path)
  /** @type {string} */
  const res = await collect(rs)
  return res
}
672796
def read_file(path)
      result = nil
      File.open(path, 'rb', encoding: 'UTF-8') { |f| result = f.read }
      result
    end
925958
public boolean canRead(String path)
  {
    try {
      ZipEntry entry = getZipEntry(path);

      return entry != null && ! entry.isDirectory();
    } catch (IOException e) {
      log.log(Level.FINE, e.toString(), e);

      return false;
    }
  }
48271
function read(path, options, fn) {
  var str = readCache[path]

  // cached (only if cached is a string and not a compiled template function)
  if (options.cache && str && typeof str === 'string') return fn(null, str)

  // read
  fs.readFile(path, 'utf8', function(err, str) {
    if (err) return fn(err)
    if (options.cache) readCache[path] = str
    fn(null, str)
  })
}
377764
function(path) {
		if (!path) return;
		
		for (var lib = IO.ls(SYS.pwd+path), i = 0; i < lib.length; i++) 
			if (/\.js$/i.test(lib[i])) load(lib[i]);
	}
473082
def read(path):
    
    # This function implementation was chosen to be compatible across Python 2/3.
    f = open(path, 'rb')
    # We avoid use of the with keyword for Python 2.4 support.
    try:
        b = f.read()
    finally:
        f.close()

    return b.decode(FILE_ENCODING)
1331913
function loadConfig(path) {
  try {
    var configJSON = JSON.parse(fs.readFileSync(process.cwd() + "/" + path));
    console.log("Config file detected: " + path)
    return configJSON;
  }
  catch(e) {
    console.log("Config file: " + e.toString())
  }
}
820034
private String read(String path) throws IOException {
        StringBuffer sb = new StringBuffer();
        String tempStr;
        File file = new File(path);
        // 如果文件不存在，读取失败
        if (!file.exists()) throw new FileNotFoundException();
        FileInputStream fis = new FileInputStream(file);
        BufferedReader br = new BufferedReader(new InputStreamReader(fis));
        while ((tempStr = br.readLine()) != null) sb.append(tempStr);
        return sb.toString();
    }
844576
def read_file(path):
    
    with open(must_exist(path)) as infile:
        r = infile.read()
    return r
448337
def _read(path):
    
    input = open(path, "r", encoding="utf-8")
    try:
        return input.read()
    finally:
        input.close()
751854
async function readJSON(path) {
    const file = await read(path)
    const parsed = JSON.parse(file)
    return parsed
}
763793
public static String readFirstLine(String path) throws FileNotFoundException, IOException {
        try (FileInputStream fis = new FileInputStream(path)) {
            try (InputStreamReader isr = new InputStreamReader(fis)) {
                try (BufferedReader br = new BufferedReader(isr)) {
                    return br.readLine();
                }
            }
        }
    }
480187
def read_file(self, path):
        

        self.assert_valid_path(path)

        with open(path, 'rb') as file:
            contents = file.read().decode('UTF-8')

        return contents
787983
function readDir(path, callback) {
  nodeFs.readdir(path, function (err, names) {
    if (err) {
      if (err.code === "ENOENT") return callback();
      return callback(err);
    }
    return callback(null, names);
  });
}
317774
function(path){
      var fullPath = []; 
      try{
        var files = fs.readdirSync(path); 
        for(var i = 0; i < files.length; i++){
          fullPath.push(path + '/' + files[i]); 
        }
        return fullPath; 
      }catch(e){
        return [];
      }
    }
865884
function FileReadStream(path, options) {
  stream.Stream.call(this);
  this.readable = true;

  if(!options) {
    options = {};
  }

  this._destroyed = false;
  this._streamEnded = false;
  this._fd = null;
  this._fileName = undefined;
  this._highWaterMark = options.highWaterMark || bufferSize;
  this._offset = 0;
  this._paused = undefined;
  this._allocator = options.allocator;
  this._fileName = path;

  this._md5hash = null;
  this._md5sum = undefined;

  if (options.calcContentMd5) {
    this._md5hash = new Md5Wrapper().createMd5Hash();
  }

  this._open();
}
796899
function read(file) {

    return new Promise(function (resolve, reject) {

      _fs2['default'].readFile(file, 'utf-8', function (err, fileContent) {
        if (err) reject(err);
        resolve(fileContent);
      });
    });
  }