Skip to content

Implementing process.stdout.write and process.stderr.write in the browser #569

@ORESoftware

Description

@ORESoftware

This applies to Node.js versions 4.0.0-7.x

I have some Node.js code, and would like to get it running the browser. In many places in my Node.js code, I have made calls to process.stdout.write and process.stderr.write.

In the browser, we have console.log / console.error

I do not need high-performance here. If I implement these methods in the browser like so:

    process.stdout.write = function(v){
       return console.log(v);
    };
    
    process.stdout.error = function(v){
       return console.error(v);
    };

that's obviously not going to really get us what we want.
Is there a way to hook into console.log / console.error in the browser to print to stdout/stderr without printing a newline char?

This is sort of about Node.js but more about browser internals, but thought someone might know around here, thanks

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