skill-checker 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +14 -7
- package/dist/cli.js.map +1 -1
- package/dist/index.js +14 -7
- package/dist/index.js.map +1 -1
- package/package.json +3 -1
package/dist/index.js
CHANGED
|
@@ -160,14 +160,23 @@ function enumerateFiles(dirPath, warnings) {
|
|
|
160
160
|
content = readFileSync(fullPath, "utf-8");
|
|
161
161
|
} catch {
|
|
162
162
|
}
|
|
163
|
-
} else
|
|
163
|
+
} else {
|
|
164
164
|
let fd;
|
|
165
165
|
try {
|
|
166
166
|
fd = openSync(fullPath, "r");
|
|
167
|
-
const
|
|
168
|
-
const
|
|
169
|
-
|
|
170
|
-
|
|
167
|
+
const headBuf = Buffer.alloc(PARTIAL_READ_LIMIT);
|
|
168
|
+
const headBytesRead = readSync(fd, headBuf, 0, PARTIAL_READ_LIMIT, 0);
|
|
169
|
+
const headContent = headBuf.slice(0, headBytesRead).toString("utf-8");
|
|
170
|
+
const tailOffset = Math.max(0, lstats.size - PARTIAL_READ_LIMIT);
|
|
171
|
+
const tailBuf = Buffer.alloc(PARTIAL_READ_LIMIT);
|
|
172
|
+
const tailBytesRead = readSync(fd, tailBuf, 0, PARTIAL_READ_LIMIT, tailOffset);
|
|
173
|
+
const tailContent = tailBuf.slice(0, tailBytesRead).toString("utf-8");
|
|
174
|
+
content = tailOffset > 0 ? `${headContent}
|
|
175
|
+
/* ... window gap ... */
|
|
176
|
+
${tailContent}` : headContent;
|
|
177
|
+
warnings.push(
|
|
178
|
+
`Large file window-scanned (head+tail ${PARTIAL_READ_LIMIT} bytes each): ${relativePath} (${lstats.size} bytes total)`
|
|
179
|
+
);
|
|
171
180
|
} catch {
|
|
172
181
|
warnings.push(`Large file could not be read: ${relativePath} (${lstats.size} bytes)`);
|
|
173
182
|
} finally {
|
|
@@ -178,8 +187,6 @@ function enumerateFiles(dirPath, warnings) {
|
|
|
178
187
|
}
|
|
179
188
|
}
|
|
180
189
|
}
|
|
181
|
-
} else {
|
|
182
|
-
warnings.push(`File too large to scan: ${relativePath} (${lstats.size} bytes). Content not checked.`);
|
|
183
190
|
}
|
|
184
191
|
}
|
|
185
192
|
files.push({
|