Skip to content

Object can now be chunked to limit the read, write limit placed by the cloud provider

License

Notifications You must be signed in to change notification settings

kiran-dudyala/objectchunk4cloud

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status NPM

ObjectChunk4Cloud

Before we know ObjectChunk4Cloud, let me introduce why I have written this package. We all have come across cloud computing where the provider place a restriction on object size limit when reading or writing ex:(AWS DynamoDB has 1KB x 5 write capacity).

And as a developer we need to take these calculations into account and make consistent writes to avoid bill shocks.

Now, ObjectChunk4Cloud is a little package that is intended to address these issues. This package gets the size of the object such as (Number, String, Arrays, Buffer, Boolean). And, it chunks the array objects into user defined size in bytes.

Installation

npm install objectchunk4cloud --save

Usage Example

var objsize = require('objectchunk4cloud');

var arraylist = [{ one: 235463 }, { 23: 325 }, { "testOne": 4734 }, { "TestThree": 423534 }];
var singlearray = { one: false };
var stringvalue = "Hello World!";
var boolenvalue = false;
var numbervalue = 1243524;
var buffervalue = Buffer.from(stringvalue);

var chunkarraysize = 50; // 50 Bytes

console.log(objsize.getsizeofobjects(arraylist, chunkarraysize)); //{totalsize: "80B", eachobjectsize: "20B", output: Array(2)}
console.log(objsize.getsizeofobjects(singlearray)); //=> 16 Bytes
console.log(objsize.getsizeofvalues(stringvalue)); //=> 24 Bytes
console.log(objsize.getsizeofvalues(boolenvalue)); //=> 4 Bytes
console.log(objsize.getsizeofvalues(numbervalue)); //=> 8 Bytes
console.log(objsize.getsizeofobjects(buffervalue)); //=> 12 Bytes

Tests

npm test

Licence

ObjectChunk4Cloud is licensed under a MIT license.

About

Object can now be chunked to limit the read, write limit placed by the cloud provider

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published