ndjson

Last updated:

0 purchases

ndjson Image
ndjson Images
Add to Cart

Description:

ndjson

ndjson parser for Dart #

Tiny and simple ndjson parser library for Dart. No external dependencies.
Installation #
dependencies:
ndjson: ^<latest-version>
copied to clipboard
Import:
import 'package:ndjson/ndjson.dart';
copied to clipboard
Usage #
The usage is pretty straightforward:
import 'package:ndjson/ndjson.dart';

// Your ndjson stream.
final Stream<String|List<int>> ndjsonStream = ...

// A new stream that will parse all chunks and emit events
// for each new json object (not ndjson chunks).
final Stream<NdjsonLine> parsedNdjson = ndjsonStream.parseNdjson();

// Using converter functions:
final Stream<Dummy> ndjson = ndjsonSource.parseNdjsonWithConverter<Dummy>(
whenMap: Dummy.fromJson,
);
copied to clipboard

Supported ndjson types are:

Stream<List<int>>.
Stream<Uint8List>.
Stream<String>.


Any list-like ndjson source can be converted to Stream using:
Stream.fromIterable(ndjsonList);
copied to clipboard
You must be aware that using ndjson as list is the same as a regular json (you lose all ndjson performance benefits).

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.