How can you determine size of table

Determine size of table

Are you developing a custom Node for Node RED?
I'll assume your not - so I will move it out of Developing Nodes

And if you want help, please provide more then 4 words

Determine size of table


I usually use a tape measure :wink:

What kind of table. So you want the count of rows? Where is this table - on a web page?

Show us the debug msg


Hi Stephen,

I have a table to display the components from the XML file.

so, I need to determine the size of the table after putting data on it.
my regards

A html table?

Are you using node-red dashboard?

Size on screen? Count of rows?

Yes, I am using the Node-Red dashboard.
I need the size of the data on it. size of data in Bytes
I can show you the table and discuss it if you do not mind over Zoom

| Steve-Mcl
14 April |

  • | - |


I have a table to display

A html table?

Are you using node-red dashboard?


so, I need to determine the size of the table after putting data on it

Size on screen? Count of rows?

The size of the data in bytes is not related to Dashboard. You need to measure the input not how it translates to HTML - unless you have some issues with client browsers and want to try and identify how much memory the table is using in the browser.

I'm afraid your requirement isn't clear.

I'm sorry, I can still not fully understand what you want.

For example, the "size" (in bytes) is still not clear - especially as you talk about dashboards and tables.
I mean, do you want the size of all HTML elements the table creates? OR just the size (in bytes) of the data values?

NOTE: If you simply mean you would like to know the size of the payload (data) before you send it to the dashboard, then you can do that in a function node using something like this sizeOf library in a function node to measure the payload.

If you actually need to know the size at client side, then The Google Chrome Heap Profiler allows you to inspect object memory use.

I have 2 experiments so I need to check the size of both tables to compare them with each other.

You are not really providing much information to allow people to help you.

Can you provide more details, examples of your data etc ?

If your tables come from 2 xml files it sounds like you would do better to compare the 2 files ?

In the first experiment, I convert XML to JSON to read data and save it in a Table by using Node-Red so I want here to determine the size of the Table.Honestly,

I got the result but I am not quite sure is true.

Test your method with some data that you do know the size of.

But what do you mean by "true"? That method is certainly accurately measuring A size but do you understand what you've created?

If all you want is a rough comparison then that method should be fine. But because you've converted the JSON to a string, you will have added some size to it and might even have lost data since not everything can be stringified from a JavaScript object.

I see a line in your function that doesn't seem correct ?

//Convert the size to Kilobytes
var sizeInKB = sizeInBytes

Perhaps this would be better ?

//Convert the size to Kilobytes
var sizeInKB = sizeInBytes/1024

which line mate?

the function of the second experiment is to get the size of the table as follows:

long size = System.Text.Encoding.UTF8.GetByteCount(strSelectedComponentStream);
double sizeInByte = size;
labSizeFile.Text = sizeInByte.ToString() + "Bytes";

Yes, you are right mate when I determine the size of the table gives me a big result So how can I determine the size of the table without converting JSON to string ?

In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote ```)

   code goes here 

You can edit and correct your post by clicking the pencil :pencil2: icon.

See this post for more details - How to share code or flow json

Some quick searching turned up this:

object-sizeof - npm (

But I see that Steve already mentioned it.

The only alternative I can come up with would be to create a web page, feed your data into a JS variable on it and write it to localStorage, measuring the remaining free storage before and after.