Synchronously reads a file from the local filesystem.

@param {File} args.file - The {@link File} to read
@param {function} args.next - Calls the next plugin, if the file is not a local filesystem file
@returns {Buffer|undefined}
421817
function readFileSync (args) {
    var file = args.file;
    var next = args.next;

    if (isUnsupportedPath(file.url)) {
      // It's not a filesystem path, so let some other plugin handle it
      return next();
    }

    var filepath = getFileSystemPath(file.url);

    inferFileMetadata(file);
    return fs.readFileSync(filepath);
  }
668820
function readFiles (filepaths, callback) {
  async.map(filepaths, readFile.bind(this), function (err, files) {

    if (err) callback(err);

    callback(null, files);
  });
}
208240
function bufferFromFile( filename ) {
	console.info( ("Loading "+filename).grey );
	var buf = fs.readFileSync( filename ),	// Load Buffer
    	ab = new ArrayBuffer( buf.length ),	// Create an ArrayBuffer to fit the data
    	view = new Uint8Array(ab);			// Create an Uint8Array view

    // Copy buffer into view
    for (var i = 0; i < buf.length; ++i)
        view[i] = buf[i];

    // Return buffer view
    return view;
}
1275947
function streamFile(namespace, fileName) {
  return gfsPromise.then(function(gfs) {
    var deferred = q.defer();
    var options = {
      filename: fileName
    };
    if (namespace) {
      options.root = namespace;
    }
    var readstream = gfs.createReadStream(options);
    readstream.on('error', function(err) {
      console.log('An error occurred when reading file from gridfs!', err);
    });
    deferred.resolve(readstream);
    return deferred.promise;
  });
}
12944
function getFile(name, next) {
    // save the callback
    fileCallBacks[name] = next;

    setImmediate(function () {
        try {
            ExtractContent.extractContent(name, handleGetFile, _requestFileContent);
        } catch (error) {
            console.log(error);
        }
    });
}
1002344
function(file) {
      var defer = new $.Deferred(),
        size = file.size,
        args = {
          url: file.source,
          dataType: 'script'
        };

      // Disables script execution when loaded upon users request.
      if ((typeof file.stopExecution === 'undefined' && stopExecution) || file.stopExecution === true)
        args.converters = {
          'text script': function(text) {
            return text;
          }
        };


      $.ajax(args).done(function(data) {

        log('File Loaded:' + file.source);

        _bytesLoaded += size;

        onElementLoaded(file, data);

        // removing the file from the array
        _files[_currentSegment].splice(0, 1);
        updatePercentage();
        defer.resolve();
      })
        .fail(function(jqxhr, settings, exception) {
          log('\n File Failed: ' + file.source +
            '\n Message:     ' + exception.message + '\n');
        });

      return defer.promise();
    }
897887
function(callback){
    var argFiles,
        filePath,
        i;

    if(!program.files || program.files.length === 0){
        return callback(null, true);
    }

    argFiles = program.files.split(',');

    output("Loading files...");

    for(i=0; i<argFiles.length; i++){
        filePath = path.resolve(__dirname, argFiles[i].toString());
        output("Reading file..." + filePath);
        if(fs.existsSync(filePath)){
            files.push(fs.readFileSync(filePath));
        }else{
            return callback("File does not exist, " + filePath, false);
        }
    }

    callback(null, true);
}
904010
async function getFileInput(args) {
    if (typeof args.in !== 'string') {
        return null;
    }
    // Let any errors fall through to the runProgram() promise
    return JSON.parse(await txtfile.read(path.resolve(args.in)));
}
626098
private static String[] readArgsFile(String argsFile) throws IOException {
    final ArrayList<String> lines = new ArrayList<String>();
    final BufferedReader reader = new BufferedReader(
        new InputStreamReader(
            new FileInputStream(argsFile), "UTF-8"));
    try {
      String line;
      while ((line = reader.readLine()) != null) {
        line = line.trim();
        if (!line.isEmpty() && !line.startsWith("#")) {
          lines.add(line);
        }
      }
    } finally {
      reader.close();
    }
    return lines.toArray(new String [lines.size()]);
  }
632866
function(next) {
          async.map([src,dest], function(path, done) {
            fs.stat(path, function(err, stat) {
              done(null, stat); // Ignore error
            });
          },
          function(err, results) {
            statSrc  = results[0];
            statDest = results[1];
            if(!statSrc) {
              // src is needed
              next(new Error('File not found: ' + src));
            }
            // Ignore anything that is not directory or file
            if(!(statSrc.isFile() || statSrc.isDirectory())) {
              grunt.verbose.writeln('  Ignore:'+' Source is not a file or a directory.'.grey);
              return done(null, false);
            }

            // Add stat to options for user defined transform & process
            options.statSrc  = statSrc;
            options.statDest = statDest;

            next();
          });
        }
188806
function fsReaddirSync(root, files, fp) {
  if (typeof root !== 'string') {
    throw new TypeError('fsReaddir.sync: expect `root` to be string');
  }

  fp = fp || '';
  files = files || [];

  var dir = path.join(root, fp);
  if (fs.statSync(dir).isDirectory()) {
    fs.readdirSync(dir).forEach(function(name) {
      fsReaddirSync(root, files, path.join(dir, name));
    });
  } else {
    files.push(fp);
  }

  return files;
}
327091
def read_file(self, file: Union[IO, asyncio.StreamWriter]=None):
        '''
        '''
        if file:
            file_is_async = hasattr(file, 'drain')

        while True:
            data = yield from self._connection.read(4096)

            if not data:
                break

            if file:
                file.write(data)

                if file_is_async:
                    yield from file.drain()

            self._data_event_dispatcher.notify_read(data)
1098694
function loadArff(fileName, callback) {
  ARFF.load(fileName, (error, data) => {
    if (error) {
      throw new Error(filename + error);
    }
    callback(data);
  });
  
  return 'THIS IS ASYNCHRONOUS';
}
141417
function readFileCache (path, noCache, cb) {
    path = abs(path);

    if (typeof noCache === "function") {
        cb = noCache;
        noCache = false;
    }

    // TODO: Callback buffering
    if (_cache[path] && noCache !== true) {
        return cb(null, _cache[path]);
    }

    read(path, (err, data) => {
        if (err) { return cb(err); }
        cb(null, _cache[path] = data);
    });
}
661451
function ReadFile(path, callback) {
    if (typeof callback === "function") {
        return Fs.readFile(path, ENCODING, callback);
    }
    return Fs.readFileSync(path, ENCODING);
}
435516
function(file, callback) {
      if (any(hook('loading', file), haveStopped)) return
      if ('readFile' in main)
        return readFile(file)
      else if (this.hasXhr()) {
        var request = this.xhr()
        request.open('GET', file, false)
        request.send(null)
        if (request.readyState == 4 && 
           (request.status == 0 || 
            request.status.toString().charAt(0) == 2)) 
          return request.responseText
      }
      else
        error("failed to load `" + file + "'")
    }
123659
function splitLocalFile(file, N, callback) {
  const split = [];
  const size = fs.statSync(file).size;
  const maxBlockSize = Math.ceil(size / (N || 1));
  let start = 0;

  // var str = fs.readFileSync(file, {encoding: 'utf8'}).replace(/\n/g, '*');
  // console.log(str)
  while (start < size) {
    // console.log('Split n° %d = %s', split.length, str.substr(start, maxBlockSize + 1))
    split.push({index: split.length, chunk: [{path: file, opt: {start: start, end: start + maxBlockSize}}]});
    start += maxBlockSize + 1;
  }

  callback(split);
}