1 | # server-timify
|
2 |
|
3 | [![npm version](https://img.shields.io/npm/v/server-timify)](https://npmjs.com/package/server-timify)
|
4 | [![npm size](https://img.shields.io/bundlephobia/minzip/server-timify)](https://bundlephobia.com/package/server-timify)
|
5 | [![install size](https://packagephobia.com/badge?p=server-timify)](https://packagephobia.com/result?p=server-timify)
|
6 | [![code coverage](https://codecov.io/gh/getoslash/server-timify/branch/main/graph/badge.svg?token=VBS5M4qYfz)](https://codecov.io/gh/getoslash/server-timify)
|
7 | [![Release](https://github.com/getoslash/server-timify/actions/workflows/release.yml/badge.svg?event=push)](https://github.com/getoslash/server-timify/actions/workflows/release.yml)
|
8 | [![Open in Visual Studio Code](https://open.vscode.dev/badges/open-in-vscode.svg)](https://open.vscode.dev/getoslash/server-timify)
|
9 |
|
10 | ⏱ Parse and stringifying utility methods for the [`Server-Timing`](https://www.smashingmagazine.com/2018/10/performance-server-timing/) header. Very forgiving and does not throw any errors for any invalid input.
|
11 |
|
12 | ## Install
|
13 |
|
14 | ```bash
|
15 | npm install server-timify
|
16 | # OR
|
17 | yarn add server-timify
|
18 | ```
|
19 |
|
20 | ## Usage
|
21 |
|
22 | ```typescript
|
23 | import { parse, stringify } from 'server-timify'
|
24 |
|
25 | parse('cache;desc="Cache Read";dur=23.2')
|
26 | // [{ name: "cache", description: "Cache Read", duration: 23.2 }]
|
27 |
|
28 | stringify([{ name: "cache", description: "Cache Read", duration: 23.2 }])
|
29 | // cache;desc="Cache Read";dur=23.2
|
30 | ```
|
31 |
|
32 | Read ["Measuring Performance With Server Timing"](https://www.smashingmagazine.com/2018/10/performance-server-timing/) to learn how to use the `Server-Timing` header.
|
33 |
|
34 | ## License
|
35 |
|
36 | The code in this project is released under the [MIT License](LICENSE).
|
37 |
|
38 | [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fgetoslash%2Fserver-timify.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fgetoslash%2Fserver-timify?ref=badge_large)
|