@lark-project/cli
Version:
飞书项目插件开发工具
26 lines (25 loc) • 730 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.readEvents = void 0;
const fs_extra_1 = require("fs-extra");
const paths_1 = require("./paths");
function readEvents() {
const p = (0, paths_1.getEventsPath)();
if (!(0, fs_extra_1.existsSync)(p))
return [];
const content = (0, fs_extra_1.readFileSync)(p, 'utf8');
const events = [];
for (const line of content.split('\n')) {
const trimmed = line.trim();
if (!trimmed)
continue;
try {
events.push(JSON.parse(trimmed));
}
catch (_a) {
// 损坏行跳过,不阻断重放
}
}
return events;
}
exports.readEvents = readEvents;