Socket
Socket
Sign inDemoInstall

dyno-item-size

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    dyno-item-size

compute the size of an item the same way dynamodb does


Version published
Weekly downloads
1.2K
increased by5.94%
Maintainers
1
Install size
12.5 kB
Created
Weekly downloads
 

Readme

Source

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.

FAQs

Last updated on 11 Mar 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc