MCPcopy Index your code
hub / github.com/prettier/prettier / readFileFirstLine

Function readFileFirstLine

src/utilities/get-interpreter.js:8–17  ·  view source on GitHub ↗

* @param {string | URL} file * @returns {string | undefined}

(file)

Source from the content-addressed store, hash-verified

6 * @returns {string | undefined}
7 */
8function readFileFirstLine(file) {
9 const liner = new readlines(toPath(file));
10 const firstLineBuffer = liner.next();
11
12 if (typeof liner.fd === "number") {
13 liner.close();
14 }
15
16 return firstLineBuffer?.toString("utf8");
17}
18
19/**
20 * @param {string | URL} file

Callers 1

getInterpreterFunction · 0.85

Calls 4

closeMethod · 0.80
toPathFunction · 0.50
nextMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…