Skip to content

Commit ba8d9fd

Browse files
committed
docs: update README with TypeScript examples, project stats, and community links
1 parent d75fabf commit ba8d9fd

1 file changed

Lines changed: 44 additions & 3 deletions

File tree

README.md

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,36 @@
77

88
A lightweight, high-performance file size utility that converts bytes to human-readable strings. Zero dependencies. 100% test coverage.
99

10+
## Why filesize.js?
11+
12+
- **Zero dependencies** - Pure JavaScript, no external packages
13+
- **100% test coverage** - Reliable, well-tested codebase
14+
- **TypeScript ready** - Full type definitions included
15+
- **Multiple standards** - SI, IEC, and JEDEC support
16+
- **Localization** - Intl API for international formatting
17+
- **BigInt support** - Handle extremely large file sizes
18+
- **Functional API** - Partial application for reusable formatters
19+
- **Browser & Node.js** - Works everywhere
20+
1021
## Installation
1122

1223
```bash
1324
npm install filesize
1425
```
1526

27+
## TypeScript
28+
29+
Fully typed with TypeScript definitions included:
30+
31+
```typescript
32+
import { filesize, partial } from 'filesize';
33+
34+
const result: string = filesize(1024);
35+
const formatted: { value: number; symbol: string; exponent: number; unit: string } = filesize(1024, { output: 'object' });
36+
37+
const formatter: (arg: number | bigint) => string = partial({ standard: 'iec' });
38+
```
39+
1640
## Usage
1741

1842
```javascript
@@ -141,7 +165,7 @@ npm test # Run all tests (lint + node:test)
141165
npm run test:watch # Live test watching
142166
```
143167

144-
**100% test coverage** with 139 tests:
168+
**100% test coverage** with 149 tests:
145169

146170
```
147171
--------------|---------|----------|---------|---------|-------------------
@@ -169,8 +193,8 @@ npm run lint:fix # Auto-fix linting issues
169193
```
170194
filesize.js/
171195
├── src/
172-
│ ├── filesize.js # Main implementation (198 lines)
173-
│ ├── helpers.js # Helper functions (181 lines)
196+
│ ├── filesize.js # Main implementation (285 lines)
197+
│ ├── helpers.js # Helper functions (215 lines)
174198
│ └── constants.js # Constants (81 lines)
175199
├── tests/
176200
│ └── unit/
@@ -189,6 +213,23 @@ filesize.js/
189213
2. Avoid locale formatting in performance-critical code
190214
3. Use `object` output for fastest structured data access
191215

216+
## Browser Usage
217+
218+
```html
219+
<script src="https://cdn.jsdelivr.net/npm/filesize@11/dist/filesize.umd.min.js"></script>
220+
<script>
221+
filesize(1024); // "1.02 kB"
222+
</script>
223+
```
224+
225+
## Contributing
226+
227+
We welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING.md) for details.
228+
229+
## Changelog
230+
231+
See [CHANGELOG.md](CHANGELOG.md) for a history of changes.
232+
192233
## License
193234

194235
Copyright (c) 2026 Jason Mulligan

0 commit comments

Comments
 (0)