xy-server/node_modules/ts-node-dev/lib/check-file-exists.js
2025-04-23 09:34:08 +08:00

12 lines
271 B
JavaScript

var fs = require('fs')
var filePath = process.argv[2]
const handler = function (stat) {
if (stat && stat.birthtime.getTime() > 0) {
process.exit(0)
}
}
fs.watchFile(filePath, { interval: 100 }, handler)
fs.stat(filePath, function (err, stat) { handler(stat) })