MCPcopy Index your code
hub / github.com/nodejs/node / #writeFile

Method #writeFile

deps/npm/lib/utils/timers.js:54–67  ·  view source on GitHub ↗
(metadata)

Source from the content-addressed store, hash-verified

52 }
53
54 #writeFile (metadata) {
55 const globalStart = this.started
56 const globalEnd = this.#finished[INITIAL_TIMER]
57 const content = {
58 metadata,
59 timers: this.#finished,
60 // add any unfinished timers with their relative start/end
61 unfinishedTimers: [...this.#unfinished.entries()].reduce((acc, [name, start]) => {
62 acc[name] = [start - globalStart, globalEnd - globalStart]
63 return acc
64 }, {}),
65 }
66 fs.writeFileSync(this.#file, JSON.stringify(content) + '\n')
67 }
68
69 #timeHandler = (level, name) => {
70 const now = Date.now()

Callers 1

finishMethod · 0.95

Calls 3

reduceMethod · 0.80
entriesMethod · 0.45
writeFileSyncMethod · 0.45

Tested by

no test coverage detected