dyno-item-size

0.3.3 • Public • Published

CircleCI

Dyno Item Size

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.

Usage

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

API

dynoItemSize comes with a two helper functions to translate the size of an object into it's read or write capacity cost.

dynoItemSize(object)

Takes an object like the one shown in usage and returns the size in bytes.

dynoItemSize.read(object)

Takes an object like the one shown in usage and returns the read capacity cost.

dynoItemSize.write(object)

Takes an object like the one shown in usage and returns the write capacity cost.

Resources

This module has been implemented by reading a few resources.

Readme

Keywords

none

Package Sidebar

Install

npm i dyno-item-size

Weekly Downloads

1,045

Version

0.3.3

License

MIT

Unpacked Size

12.8 kB

Total Files

6

Last publish

Collaborators

  • mcwhittemore