sizeof
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/sizeof package

1.0.0 • Public • Published

sizeof

Calculates the approximate size of Javascript object.

Example

var sizeof = require('sizeof'); 
var anyObject = {
	'key': {
		name: 'abc', 
		age: 123, 
		active: true
	}
}
console.log(sizeof.sizeof(anyObject));	// 50
console.log(sizeof.sizeof(anyObject, true));	// 50B

APIs

  • sizeof(object, pretty)

    • Gets the approximate size of the given object in bytes.
    • pretty: if sets to true, returns the size in pretty format (e.g., 35.298K).

/sizeof/

    Package Sidebar

    Install

    npm i sizeof

    Weekly Downloads

    2,414

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • lyroyce