I use the dynamo set function to store data in DynamoDB, but sometimes the data is too big. Is there a function that I can use to determine if the data is too big to be saved in DynamoDB? a Node js function? Thanks
This should work even if the data is an object with arrays and other objects.
I tried to npm module object-sizeof, does that work?
You can use dyno-item-size module to get the item size.
var dynoItemSize = require('dyno-item-size');
var size = dynoItemSize(item);
var params = {
TableName : table,
Item : {
"autoID" : "yyy",
"alexandriaID" : "id1",
"docType" : "foo",
"username" : "good",
"userdescription" : "user description",
"comment" : "complex condition"
}
};
console.log("Size of item =====>" + dynoItemSize(params.Item));
References:-
ItemSize in DynamoDB http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithItems.html
An item size is the sum of lengths of its attribute names and values (binary and UTF-8 lengths);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With