We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e657463 commit 6ed1e03Copy full SHA for 6ed1e03
src/modules/JsonArrayAppend.ts
@@ -1,5 +1,5 @@
1
import { stat, open, FileHandle } from "fs/promises";
2
-import { CHARACTER } from "../constants";
+import { CHARACTER, ERRORS } from "../constants";
3
4
const appendToJsonArray = async (
5
filePath: string,
@@ -28,6 +28,10 @@ const appendToJsonArray = async (
28
insertPosition +=
29
i === 0 ? 0 : Buffer.byteLength(windowValue.slice(0, i), encoding);
30
break searchForArrayEnd;
31
+ } else if (
32
+ ![CHARACTER.NEW_LINE, CHARACTER.SPACE].includes(windowValue[i])
33
+ ) {
34
+ throw new Error(ERRORS.INVALID_FILE);
35
}
36
37
0 commit comments