How to use the stream-json/Stringer.stringer function in stream-json

To help you get started, we’ve selected a few stream-json examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ravendb / ravendb-nodejs-client / test / Mapping / StreamJsonTests.ts View on Github external
it("stringer for query result response with negative result etag", (done) => {
        const content = fs.readFileSync(path.join(__dirname, "../Assets/queryResult.json"), "utf-8");
        const readable = new stream.Readable();
        readable.push(content);
        readable.push(null);

        const parser = new Parser({
            streamValues: false
        });

        const stringerInstance = stringer({ useValues: true });
        let output = "";
        stringerInstance.on("data", data => output += data.toString());

        stream.pipeline(
            readable,
            parser,
            stringerInstance, 
            (err) => {
                err ? done(err) : done();
                assert.strictEqual(output, content);
            });
    });

stream-json

stream-json is the micro-library of Node.js stream components for creating custom JSON processing pipelines with a minimal memory footprint. It can parse JSON files far exceeding available memory streaming individual primitives using a SAX-inspired API. I

BSD-3-Clause
Latest version published 11 months ago

Package Health Score

74 / 100
Full package analysis