Home > Software engineering >  Calculating the size of a node in Firebase Realtime Database
Calculating the size of a node in Firebase Realtime Database

Time:01-22

I have this node in Realtime Database:

{
 fieldA: 123,
 field2: '456',
 field3: true,
}

How is this calculated on an individual node basis?

CodePudding user response:

If you're asking about the storage and bandwidth cost of transferring this object, Firebase uses pretty much the JSON size for the node without whitespace. So for your code:

let node = {
 fieldA: 123,
 field2: '456',
 field3: true,
}

console.log(JSON.stringify(node).length);

  • Related