Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8053527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:52:32+00:00 2026-06-05T07:52:32+00:00

Is there a function in Node.js that reads characters from a stream until it

  • 0

Is there a function in Node.js that reads characters from a stream until it reads a complete JavaScript expression and returns that expression? The “read” part of the read-eval-print loop?

I want to read JSON objects from a stream and process them as they come in. I don’t need the interactive parts of REPL in this use case.

{"r": 0.0,
 "e": -0.2,
 "t": 0.98}
// callback happens here with the content of the object

{"r": 0.2,
 "e": 0.0,
 "t": 1.0}
// callback happens here with the content of the object
// etc
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T07:52:35+00:00Added an answer on June 5, 2026 at 7:52 am

    A complete Javascript expression is not necessarily a valid JSON serialization, e.g. { foo: 'bar' } is a valid JS expression, but invalid JSON (JSON requires double-quoted object keys and string literals). If you know that your JSON objects will always end on a newline boundary, you can accumulate lines in a variable, trying to JSON.parse() it until you succeed (an unsuccessful JSON.parse() would throw a SyntaxError), but that would not allow you to detect errors in your input (you’ll just accumulate lines forever). If you provide more details about what and how exactly you expect to receive, there might be other, more suitable approaches.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a function in javascript that compares a string and returns a boolean?
I'd like to make a node.js function that, when calls, reads a file, and
There is an error with the function appendChild : Node cannot be inserted at
I know there is the current() function to retrieve the current node in XSL,
Is there a function in Apple's library that can reverse the order of the
Is there a function like $pluginsDir = sfConfig::get('sf_config_dir'); (which returns configuration directory for overall)
In a node program I'm reading from a file stream with fs.createReadStream . But
I know that node.js is said to be event-driven I/O server-side javascript hosted on
I want to use ._get_type ( node ) function from jsTree plugin types The
I'm writing a program that calls a function in main that creates a node

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.