# get-files-size

> 获取路径下指定类型的文件总大小

Latest version **1.0.2** (published 2021-01-16) · ISC license · 0 weekly downloads

## Install

```sh
npm install get-files-size
pnpm add get-files-size
yarn add get-files-size
bun add get-files-size
```

Provides the command `get-files-size`.

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2021-01-16 |
| First published | 2021-01-16 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 7.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | kael |
| Maintainers | kael23 |
| Keywords | get, files, file, size, cli |

## Links

- npm: https://www.npmjs.com/package/get-files-size
- Repository: https://github.com/kaeryehaowan/get-files-size
- Homepage: https://github.com/kaeryehaowan/get-files-size#readme
- Issues: https://github.com/kaeryehaowan/get-files-size/issues
- npm.io page: https://npm.io/package/get-files-size

## Dependencies (3)

- [chalk](https://npm.io/package/chalk.md) ^4.1.0
- [commander](https://npm.io/package/commander.md) ^7.0.0
- [tiny-each-async](https://npm.io/package/tiny-each-async.md) ^2.0.3

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 1.0.2 (latest) — 2021-01-16
- 1.0.1 — 2021-01-16
- 1.0.0 — 2021-01-16

## README

### get-files-size
获取路径下指定类型的文件总大小，不会计算文件夹大小。例如,
```
└─ src
    ├── style
    |  └── a.css
    ├── js
    |  ├── index.js
    |  ├── utils.js
    |  └── shop.js
    └── package.json
```
有 /src 目录，目录下有 /style 与 /js 两个文件夹和一个 package.json文件。当使用 
```js
get-files-size ./src  -t js
```
只会计算   
./src/js/index.js   
./src/js/utils.js   
./src/js/shop.js   
三个文件的大小，并相加，不会计算 ./src/js/ 文件夹的大小。

### Installation
```js
npm i get-files-size -g
```

### Usage
```js
// index.js
const getFilesSize = require('get-files-size');

getFilesSize(path, [options], function callback(err, size){
    if(!err){
        console.log(size)
    }
})

// terminal 
get-files-size  ./src  -t js,css,html,json -u K -i /node_modules/ -c

// terminal path也可以通过 -p 传入，同时传入时，取选项 path 传入的值
get-files-size -p ./src  -t .js,.css,html,json -u K -i /node_modules/ -c
```

### Options
| 选项 | 说明 |
| --- | --- |
| -p[path] | 文件夹或文件路径 |
| -t[type] | 文件类型，取后缀，例如 css、js、png等，符号点[.]可省略 |
| -u[unit] | 文件大小单位，B K M G |
| -i[ignore] | 需要忽略的路径，例如 node_modules |
| -c[chalk] | 是否需要打印参与计算的文件明细 |

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