MCPcopy Create free account
hub / github.com/EvoMap/evolver / jsonlLineForWrite

Function jsonlLineForWrite

src/proxy/mailbox/store.js:102–114  ·  view source on GitHub ↗
(obj, opts = {})

Source from the content-addressed store, hash-verified

100// regular files that POSIX local filesystems do, so the removal above is
101// equally valid on Windows. No platform-specific code is needed here.
102function jsonlLineForWrite(obj, opts = {}) {
103 const line = JSON.stringify(obj) + '\n';
104 const maxLineBytes = Math.max(1, Math.floor(Number(opts.maxLineBytes) || resolveMaxJsonlLineBytes()));
105 const lineBytes = Buffer.byteLength(line, 'utf8');
106 if (lineBytes > maxLineBytes) {
107 const err = new Error(`mailbox JSONL line is ${lineBytes} bytes; maximum is ${maxLineBytes} bytes`);
108 err.code = 'MAILBOX_JSONL_LINE_TOO_LARGE';
109 err.lineBytes = lineBytes;
110 err.maxLineBytes = maxLineBytes;
111 throw err;
112 }
113 return line;
114}
115
116function appendLine(filePath, obj) {
117 const line = jsonlLineForWrite(obj);

Callers 2

appendLineFunction · 0.85
compactMethod · 0.85

Calls 1

resolveMaxJsonlLineBytesFunction · 0.85

Tested by

no test coverage detected