-
Sorry, first time using this library, just wanted to know if there is a way to insert additional data, say in a streamArray(). |
Beta Was this translation helpful? Give feedback.
Answered by
uhop
Sep 6, 2024
Replies: 1 comment 1 reply
-
Just use stream-chain, which is the only dependency of const {chain} = require('stream-chain');
const pipeline = chain([
fs.createReadStream('data.json.gz'),
zlib.createGunzip(),
parser(),
streamArray(),
function* ({key, value}) {
if (key % 2 == 1) yield 123;
yield 'qwerty';
yield {key, value: value + 42};
// and so on
}
]); Imagination is the only limit. Two notes:
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
sanjacob
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just use stream-chain, which is the only dependency of
stream-json
(a sketch):Imagination is the only limit.
Two notes:
[null]
or{value: null}
.stream-chain
used by this package is 2.x (no need to import it explicitly). The newly released version ofstream-chain
is 3.x. Its wiki clearly separates 2.x f…