This file is indexed.

/usr/lib/nodejs/read-file/index.js is in node-read-file 0.2.0-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/**
 * read-file <https://github.com/assemble/read-file>
 *
 * Copyright (c) 2014, 2015 Jon Schlinkert.
 * Licensed under the MIT license.
 */

var fs = require('fs');

function read(fp, opts, cb) {
  if (typeof opts === 'function') {
    cb = opts;
    opts = {};
  }

  if (typeof cb !== 'function') {
    throw new TypeError('read-file async expects a callback function.');
  }

  if (typeof fp !== 'string') {
    cb(new TypeError('read-file async expects a string.'));
  }

  fs.readFile(fp, opts, function (err, buffer) {
    if (err) return cb(err);
    cb(null, normalize(buffer, opts));
  });
}

read.sync = function(fp, opts) {
  if (typeof fp !== 'string') {
    throw new TypeError('read-file sync expects a string.');
  }
  try {
    return normalize(fs.readFileSync(fp, opts), opts);
  } catch (err) {
    err.message = 'Failed to read "' + fp + '": ' + err.message;
    throw new Error(err);
  }
};

function normalize(str, opts) {
  str = stripBom(str);
  if (typeof opts === 'object' && opts.normalize === true) {
    return String(str).replace(/\r\n|\n/g, '\n');
  }
  return str;
}

function stripBom(str) {
  return typeof str === 'string' && str.charAt(0) === '\uFEFF'
    ? str.slice(1)
    : str;
}

/**
 * Expose `read`
 */

module.exports = read;