Skip to content

A simple node utility to calculate the size of a item as DynamoDB does.

Notifications You must be signed in to change notification settings

mcwhittemore/dyno-item-size

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

A simple node utility to calculate the size of a item as DynamoDB does.

Resources

Stars

Watchers

Forks

Packages

No packages published