MCPcopy Index your code
hub / github.com/nodejs/node / writeFileWorker

Function writeFileWorker

test/fixtures/snapshot/typescript.js:115826–115853  ·  view source on GitHub ↗
(fileName, data, writeByteOrderMark)

Source from the content-addressed store, hash-verified

115824 }
115825 var outputFingerprints;
115826 function writeFileWorker(fileName, data, writeByteOrderMark) {
115827 if (!ts.isWatchSet(options) || !system.getModifiedTime) {
115828 system.writeFile(fileName, data, writeByteOrderMark);
115829 return;
115830 }
115831 if (!outputFingerprints) {
115832 outputFingerprints = new ts.Map();
115833 }
115834 var hash = computeHash(data);
115835 var mtimeBefore = system.getModifiedTime(fileName);
115836 if (mtimeBefore) {
115837 var fingerprint = outputFingerprints.get(fileName);
115838 // If output has not been changed, and the file has no external modification
115839 if (fingerprint &&
115840 fingerprint.byteOrderMark === writeByteOrderMark &&
115841 fingerprint.hash === hash &&
115842 fingerprint.mtime.getTime() === mtimeBefore.getTime()) {
115843 return;
115844 }
115845 }
115846 system.writeFile(fileName, data, writeByteOrderMark);
115847 var mtimeAfter = system.getModifiedTime(fileName) || ts.missingFileModifiedTime;
115848 outputFingerprints.set(fileName, {
115849 hash: hash,
115850 byteOrderMark: writeByteOrderMark,
115851 mtime: mtimeAfter
115852 });
115853 }
115854 function getDefaultLibLocation() {
115855 return ts.getDirectoryPath(ts.normalizePath(system.getExecutingFilePath()));
115856 }

Callers 1

writeFileFunction · 0.85

Calls 3

getMethod · 0.65
writeFileMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…