UNPKG

@loaders.gl/json

Version:

Framework-independent loader for JSON and streaming JSON formats

29 lines (28 loc) 1.02 kB
// loaders.gl // SPDX-License-Identifier: MIT // Copyright (c) vis.gl contributors import { parseNDJSONSync } from "./lib/parsers/parse-ndjson.js"; import { parseNDJSONInBatches } from "./lib/parsers/parse-ndjson-in-batches.js"; // __VERSION__ is injected by babel-plugin-version-inline // @ts-ignore TS2304: Cannot find name '__VERSION__'. const VERSION = typeof "4.3.2" !== 'undefined' ? "4.3.2" : 'latest'; export const NDJSONLoader = { dataType: null, batchType: null, name: 'NDJSON', id: 'ndjson', module: 'json', version: VERSION, extensions: ['ndjson', 'jsonl'], mimeTypes: [ 'application/x-ndjson', 'application/jsonlines', // https://docs.aws.amazon.com/sagemaker/latest/dg/cdf-inference.html#cm-batch 'application/json-seq' ], category: 'table', text: true, parse: async (arrayBuffer) => parseNDJSONSync(new TextDecoder().decode(arrayBuffer)), parseTextSync: parseNDJSONSync, parseInBatches: parseNDJSONInBatches, options: {} };