mirror of
https://github.com/strapi/strapi.git
synced 2025-12-28 07:33:17 +00:00
start throwing errors when parsing jsonl
This commit is contained in:
parent
26e044a58b
commit
546b6acc00
@ -60,7 +60,7 @@
|
||||
"@types/koa": "2.13.4",
|
||||
"@types/semver": "7.3.13",
|
||||
"@types/stream-chain": "2.0.1",
|
||||
"@types/stream-json": "1.7.2",
|
||||
"@types/stream-json": "1.7.3",
|
||||
"@types/tar": "6.1.3",
|
||||
"@types/tar-stream": "2.2.2",
|
||||
"@types/uuid": "9.0.0",
|
||||
|
||||
@ -190,7 +190,9 @@ class LocalFileSourceProvider implements ISourceProvider {
|
||||
async onentry(entry) {
|
||||
const transforms = [
|
||||
// JSONL parser to read the data chunks one by one (line by line)
|
||||
parser(),
|
||||
parser({
|
||||
checkErrors: true,
|
||||
}),
|
||||
// The JSONL parser returns each line as key/value
|
||||
(line: { key: string; value: object }) => line.value,
|
||||
];
|
||||
@ -213,6 +215,7 @@ class LocalFileSourceProvider implements ISourceProvider {
|
||||
return outStream;
|
||||
}
|
||||
|
||||
// For collecting an entire JSON file then parsing it, not for streaming JSONL
|
||||
async #parseJSONFile<T extends object>(fileStream: Readable, filePath: string): Promise<T> {
|
||||
return new Promise<T>((resolve, reject) => {
|
||||
pipeline(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user