Giter Site home page Giter Site logo

Comments (7)

ewnd9 avatar ewnd9 commented on June 16, 2024

Did you consider something like below?

stream.on('data', function(data) {
  table.push(data);
  var curr = table.toString().split('\n');
  console.log(curr.slice(prev.length, curr.length).join('\n'));
  prev = curr;
});

from cli-table.

gajus avatar gajus commented on June 16, 2024

@ewnd9 approach seems correct. In addition, consider using something like https://github.com/trentm/node-bunyan, which is designed for handling streams (although output is not in a tabular format).

from cli-table.

glennblock avatar glennblock commented on June 16, 2024

You think splitting a large table over and over is a good solution? That
seems pretty expensive especially for a large table.

On Tue, Aug 18, 2015 at 10:34 PM ewnd9 [email protected] wrote:

Did you consider something like below?

stream.on('data', function(data) {
table.push(data);
var curr = table.toString().split('\n');
console.log(curr.slice(prev.length, curr.length).join('\n'));
prev = curr;
});


Reply to this email directly or view it on GitHub
#78 (comment)
.

from cli-table.

glennblock avatar glennblock commented on June 16, 2024

Thanks for the tip regardless :-)
On Tue, Sep 15, 2015 at 1:29 PM Glenn Block [email protected] wrote:

You think splitting a large table over and over is a good solution? That
seems pretty expensive especially for a large table.

On Tue, Aug 18, 2015 at 10:34 PM ewnd9 [email protected] wrote:

Did you consider something like below?

stream.on('data', function(data) {
table.push(data);
var curr = table.toString().split('\n');
console.log(curr.slice(prev.length, curr.length).join('\n'));
prev = curr;
});


Reply to this email directly or view it on GitHub
#78 (comment)
.

from cli-table.

ewnd9 avatar ewnd9 commented on June 16, 2024

@glennblock hard to say without benchmarks. You could always implement something like table rotation on every n-th chunk of stream in case of low perfomance

from cli-table.

gajus avatar gajus commented on June 16, 2024

Sorry, I have actually misread the example. You don't need to render the entire table every time. A lot simpler would be to simply render a single row. I am sure cli-table or cli-table2 supports that. If not, have a look at https://www.npmjs.com/package/table.

from cli-table.

glennblock avatar glennblock commented on June 16, 2024

@ewnd9 yeah I am just imagining the scenario where one is streaming tons and tons of events. It seems completely wasteful and slow to have an infinitely growing / continually string concatenated table.

from cli-table.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.