ndjson-process-stream
Duplex stream which takes objects, pushes them into process stdin as ndjson,
takes ndjson from the process, and returns objects. It's like a through stream
for processes. Meant as a convenience module for when you want to compute on
JSONs from an external process. Comes with hello world examples from several
languages (TODO). Exposes the underlying child process from this.cp
.
const ndjsonProcess = const intoStream = const data = foo: 1 foo: 2 foo: 3 foo: 4 foo: 5
Script Examples
TODO Node, R, Go, ...
Python
TODO a way without while True
that doesn't have to wait for EOF from stdin?
#!/usr/bin/env python import sysimport json *= 2 return obj try: buff = ' while True: buff += if : results = print() buff = 'except KeyboardInterrupt: pass