# gulp-size

> Display the size of your project

Latest version **5.0.0** (published 2023-10-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install gulp-size
pnpm add gulp-size
yarn add gulp-size
bun add gulp-size
```

## Health

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

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

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 5.0.0 |
| Published | 2023-10-31 |
| First published | 2014-01-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/gulp-size) |
| Module format | ESM |
| Node | >=18 |
| Dependencies | 6 |
| Unpacked size | 6.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 225 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | gulpplugin, filesize, file, size, log, measure, inspect, debug, gzip, brotli |

## Links

- npm: https://www.npmjs.com/package/gulp-size
- Repository: https://github.com/sindresorhus/gulp-size
- Homepage: https://github.com/sindresorhus/gulp-size#readme
- Issues: https://github.com/sindresorhus/gulp-size/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/gulp-size

## Dependencies (6)

- [chalk](https://npm.io/package/chalk.md) ^5.3.0
- [fancy-log](https://npm.io/package/fancy-log.md) ^2.0.0
- [gzip-size](https://npm.io/package/gzip-size.md) ^7.0.0
- [brotli-size](https://npm.io/package/brotli-size.md) ^4.0.0
- [pretty-bytes](https://npm.io/package/pretty-bytes.md) ^6.1.1
- [gulp-plugin-extras](https://npm.io/package/gulp-plugin-extras.md) ^0.2.1

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 5.0.0 (latest) — 2023-10-31
- 4.0.1 — 2021-06-03
- 4.0.0 — 2021-05-02
- 3.0.0 — 2017-12-30
- 2.1.0 — 2016-03-10
- 2.0.0 — 2015-08-17
- 1.3.0 — 2015-08-10
- 1.2.3 — 2015-07-01
- 1.2.2 — 2015-06-21
- 1.2.1 — 2015-02-24
- 1.2.0 — 2015-01-04
- 1.1.0 — 2014-09-01
- 1.0.0 — 2014-07-25
- 0.4.1 — 2014-07-25
- 0.4.0 — 2014-06-07
- … 7 more at https://npm.io/package/gulp-size/versions

## README

# gulp-size

> Display the size of your project

<img src="screenshot.png" width="341">

Logs out the total size of files in the stream and optionally the individual file-sizes.

## Install

```sh
npm install --save-dev gulp-size
```

## Usage

```js
import gulp from 'gulp';
import size from 'gulp-size';

export default () => (
	gulp.src('fixture.js')
		.pipe(size())
		.pipe(gulp.dest('dist'))
);
```

## API

### size(options?)

#### options

Type: `object`

##### title

Type: `string`\
Default: `''`

Give it a title so it's possible to distinguish the output of multiple instances logging at once.

##### gzip

Type: `boolean`\
Default: `false`

Displays the gzipped size.

##### brotli

Type: `boolean`\
Default: `false`

Displays the brotli compressed size.

##### uncompressed

Type: `boolean`\
Default: `false` if either of gzip or brotli is `true`, otherwise `true`

Displays the uncompressed size.

##### pretty

Type: `boolean`\
Default: `true`

Displays prettified size: `1337 B` → `1.34 kB`.

##### showFiles

Type: `boolean`\
Default: `false`

Displays the size of every file instead of just the total size.

##### showTotal

Type: `boolean`\
Default: `true`

Displays the total of all files.

### size.size

Type: `number`\
Example: `12423000`

The total size of all files in bytes.

### size.prettySize

Type: `string`\
Example: `14 kB`

Prettified version of `.size`.

#### Example

You could, for example, use this to report the total project size with [`gulp-notify`](https://github.com/mikaelbr/gulp-notify):

```js
import gulp from 'gulp';
import size from 'gulp-size';
import notify from 'gulp-notify';

export default () => (

exports.default = () => {
	const sizeInstance = size();

	return gulp.src('fixture.js')
		.pipe(sizeInstance)
		.pipe(gulp.dest('dist'))
		.pipe(notify({
			onLast: true,
			message: () => `Total size ${sizeInstance.prettySize}`
		}));
};
```

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