Skip to content

Question - Is there any way to use .pipe() in NodeJS with prettyjson #18

Open

Description

@paulwehner

So for example could I do something like:

var file = fs.createReadStream('dogs.json');
file.pipe(prettyjson.render).pipe(response);

Activity

  1. rafeca commented on Aug 9, 2015

    @rafeca
    Owner

    Using streams is not currently supported, as prettyjson decodes the whole JSON data at once.

    Something similar to reading the process stdin could be done for streams.

  2. tjconcept commented on Aug 25, 2016

    @tjconcept

    I guess this is related to support stdin output that is separated by newlines (such as JSONStream.stringify(false))?

    Would be a great feature :-)

    A current workaround using the JSONStream package: JSONStream < data.njs | prettyjson.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions