# @mhoc/workers-io

> IO utilities for Cloudflare Workers.

Latest version **0.5.0** (published 2022-10-08) · 0 weekly downloads

## Install

```sh
npm install @mhoc/workers-io
pnpm add @mhoc/workers-io
yarn add @mhoc/workers-io
bun add @mhoc/workers-io
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.5.0 |
| Published | 2022-10-08 |
| First published | 2022-10-08 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 6.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | mhoc |

## Links

- npm: https://www.npmjs.com/package/@mhoc/workers-io
- npm.io page: https://npm.io/package/@mhoc/workers-io

## Dependencies (3)

- [fp-ts](https://npm.io/package/fp-ts.md) ^2.12.3
- [io-ts](https://npm.io/package/io-ts.md) ^2.2.19
- [io-ts-reporters](https://npm.io/package/io-ts-reporters.md) ^2.0.1

## Recent versions

- 0.5.0 (latest) — 2022-10-08
- 0.4.0 — 2022-10-08
- 0.3.0 — 2022-10-08
- 0.2.0 — 2022-10-08
- 0.1.0 — 2022-10-08

## README

# Workers-IO

IO utilities for Cloudflare Workers.

### Install

```
$ npm i @mhoc/workers-io
```

### io-ts

The utility functions in this library leverage [io-ts](https://github.com/gcanti/io-ts). Its a
pretty cool library. To help make things easier, this library re-exports both `io-ts` and `fp-ts`:

```ts
import { io, fp } from "@mhoc/workers-io"
```

### iofetch

iofetch is a family of wrappers around `fetch` which help to schematize the body of the response, by 
applying an `io-ts` schema to it before returning.

```ts
import { io, iofetch_json } from "@mhoc/workers-io"

const ResponseJSON = io.type({
    userId: io.string,
})

const { response, body } = await iofetch_json(ResponseJSON, "https://api.example.com/getUser")
console.log(body.userId) // compiles, and guaranteed to be a string
```

The available functions right now include:

- `iofetch_json`

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