# @blackglory/http-status

> A class-based HTTP status library

Latest version **2.0.4** (published 2026-05-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install @blackglory/http-status
pnpm add @blackglory/http-status
yarn add @blackglory/http-status
bun add @blackglory/http-status
```

## Health

**Score 60/100 (C)** — status: active.

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

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.0.4 |
| Published | 2026-05-12 |
| First published | 2020-12-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 76.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | BlackGlory |
| Maintainers | black_glory |
| Keywords | http, statusCode, status, code, 1xx, 2xx, 3xx, 4xx, 5xx |

## Links

- npm: https://www.npmjs.com/package/@blackglory/http-status
- Repository: https://github.com/BlackGlory/http-status
- Homepage: https://github.com/BlackGlory/http-status#readme
- Issues: https://github.com/BlackGlory/http-status/issues
- npm.io page: https://npm.io/package/@blackglory/http-status

## Dependencies (1)

- [@blackglory/errors](https://npm.io/package/@blackglory/errors.md) ^3.1.0

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M weekly downloads
- [jwt-simple](https://npm.io/package/jwt-simple.md) — 259.5K weekly downloads
- [@exodus/patch-broken-hermes-typed-arrays](https://npm.io/package/@exodus/patch-broken-hermes-typed-arrays.md) — 28.5K weekly downloads
- [@native-to-anchor/buffer-layout](https://npm.io/package/@native-to-anchor/buffer-layout.md) — 12.2K weekly downloads
- [binary-parser-encoder](https://npm.io/package/binary-parser-encoder.md) — 5.3K weekly downloads

## Recent versions

- 2.0.4 (latest) — 2026-05-12
- 2.0.3 — 2026-02-16
- 2.0.2 — 2023-06-11
- 2.0.1 — 2023-01-28
- 2.0.0 — 2023-01-22
- 1.0.3 — 2022-10-21
- 1.0.2 — 2022-08-01
- 1.0.1 — 2021-12-04
- 1.0.0 — 2021-02-14
- 0.2.0 — 2021-02-14
- 0.1.9 — 2021-02-04
- 0.1.8 — 2021-02-03
- 0.1.7 — 2021-01-20
- 0.1.6 — 2021-01-15
- 0.1.5 — 2021-01-04
- … 5 more at https://npm.io/package/@blackglory/http-status/versions

## README

# http-status
A class-based HTTP status library.

## Install
```sh
npm install --save @blackglory/http-status
# or
yarn add @blackglory/http-status
```

## API
### fromCode
```ts
function fromCode(code: number): HTTPStatus
```

When the status code is unknown, it will throw `UnkonwnHTTPStatusError`.

### HTTPStatus
```ts
interface HTTPStatus {
  code: number
  message: string
}
```

| Code | HTTPStatus                    |
|------|-------------------------------|
| 1xx  | HTTPInformational             |
| 100  | Continue                      |
| 101  | SwitchingProtocol             |
| 102  | Processing                    |
| 103  | EarlyHints                    |
| 2xx  | HTTPSuccessful                |
| 200  | OK                            |
| 201  | Created                       |
| 202  | Accepted                      |
| 203  | NonAuthoritativeInformation   |
| 204  | NoContent                     |
| 205  | ResetContent                  |
| 206  | PartialContent                |
| 207  | MultiStatus                   |
| 208  | AlreadyReported               |
| 226  | IMUsed                        |
| 3xx  | HTTPRedirection               |
| 300  | MultipleChoice                |
| 301  | MovedPermanently              |
| 302  | Found                         |
| 303  | SeeOther                      |
| 304  | NotModified                   |
| 307  | TemporaryRedirect             |
| 308  | PermanentRedirect             |
| 4xx  | HTTPClientError               |
| 400  | BadRequest                    |
| 401  | Unauthorized                  |
| 403  | Forbidden                     |
| 404  | NotFound                      |
| 405  | MethodNotAllowed              |
| 406  | NotAcceptable                 |
| 407  | ProxyAuthenticationRequired   |
| 408  | RequestTimeout                |
| 409  | Conflict                      |
| 410  | Gone                          |
| 411  | LengthRequired                |
| 412  | PreconditionFailed            |
| 413  | PayloadTooLarge               |
| 414  | URITooLong                    |
| 415  | UnsupportedMediaType          |
| 416  | RangeNotSatisfiable           |
| 417  | ExpectationFailed             |
| 421  | MisdirectedRequest            |
| 422  | UnprocessableEntity           |
| 423  | Locked                        |
| 424  | FailedDependency              |
| 426  | UpgradeRequired               |
| 428  | PreconditionRequired          |
| 429  | TooManyRequests               |
| 431  | RequestHeaderFieldsTooLarge   |
| 451  | UnavailableForLegalReasons    |
| 5xx  | HTTPServerError               |
| 500  | InternalServerError           |
| 501  | NotImplemented                |
| 502  | BadGateway                    |
| 503  | ServiceUnavailable            |
| 504  | GatewayTimeout                |
| 505  | HTTPVersionNotSupported       |
| 506  | VariantAlsoNegotiates         |
| 507  | InsufficientStorage           |
| 508  | LoopDetected                  |
| 510  | NotExtended                   |
| 511  | NetworkAuthenticationRequired |

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