# sizeof

> Calculates the size of Javascript object.

Latest version **1.0.0** (published 2014-08-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install sizeof
pnpm add sizeof
yarn add sizeof
bun add sizeof
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2014-08-31 |
| First published | 2014-08-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/sizeof) |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 14 |
| Author | Yin Li |
| Maintainers | lyroyce |
| Keywords | size, sizeof, js, object, array, memory |

## Links

- npm: https://www.npmjs.com/package/sizeof
- Repository: git@github.com:lyroyce/sizeof
- Homepage: https://github.com/lyroyce/sizeof
- Issues: https://github.com/lyroyce/sizeof/issues
- npm.io page: https://npm.io/package/sizeof

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.0 (latest) — 2014-08-31

## README

# 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).

---
_Source: https://npm.io/package/sizeof · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
