This is a simple utility to calculate the size of an item as DynamoDB would. The goal of this project is to be accurate within a byte so that you can make optimized requests to DynamoDB.
var dynoItemSize = require('dyno-item-size');
var item = {
'string': 'string',
'number': 27,
'buffer': new Buffer('buffer', 'utf8')
};
var size = dynoItemSize(item);
console.log(size);
// => 32
dynoItemSize
comes with a two helper functions to translate the size of an object into it's read or write capacity cost.
Takes an object like the one shown in usage and returns the size in bytes.
Takes an object like the one shown in usage and returns the read capacity cost.
Takes an object like the one shown in usage and returns the write capacity cost.
This module has been implemented by reading a few resources.