Results 1 to 2 of 2

Thread: (Node JS) Buffered stdout on child process

  1. #1
    Join Date
    Jul 2012

    (Node JS) Buffered stdout on child process

    Has anyone ever had any trouble with getting buffered data back from a child process?

    I'm running a Java application as a child process and using the restify module to send the output of the application to the browser. When I call childProcess.stdout.on('data' function (data) {
    • data should be: This is process1
    • console.log(data) is: <Buffer 54 68 69 73 20 69 73 20 70 72 6f 63 65 73 73 31 0d 0a>
    • res.send(200, data) displays in the browser as: "VGhpcyBpcyBwcm9jZXNzMQ0K"

    The funny thing is the buffer is a hex translation of "This is process1," but I don't know why it would return it in that format.

    This only seems to happen on my program with restify. I use the same .class file on a test app that only uses child processes and it works fine. What could be the problem? Any ideas?

  2. #2
    Join Date
    Mar 2014
    Yes, that is correct. You just need to convert the data into a readable string.
    data being the buffer, you can use this in Node:

    var cleanData = data.toString("utf8")     //(or whatever encoding you are using)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center