# io-promise

> I/O primitives using promises

Latest version **1.0.3** (published 2022-06-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install io-promise
pnpm add io-promise
yarn add io-promise
bun add io-promise
```

## 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.3 |
| Published | 2022-06-23 |
| First published | 2018-05-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 12 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | plehegar |
| Keywords | fetch |

## Links

- npm: https://www.npmjs.com/package/io-promise
- Repository: https://github.com/plehegar/io-promise
- Homepage: https://github.com/plehegar/io-promise#readme
- Issues: https://github.com/plehegar/io-promise/issues
- npm.io page: https://npm.io/package/io-promise

## Alternatives

- [gamedig](https://npm.io/package/gamedig.md) — 29.3K weekly downloads
- [join-monster](https://npm.io/package/join-monster.md) — 12.8K weekly downloads
- [masked](https://npm.io/package/masked.md) — 5.5K weekly downloads
- [@comunica/actor-query-process-explain-logical](https://npm.io/package/@comunica/actor-query-process-explain-logical.md) — 4.7K weekly downloads
- [@veracity/vui](https://npm.io/package/@veracity/vui.md) — 4.6K weekly downloads

## Recent versions

- 1.0.3 (latest) — 2022-06-23
- 2.0.0 — 2019-10-10
- 1.0.2 — 2019-10-09
- 1.0.1 — 2018-07-27
- 1.0.0 — 2018-05-09

## README

# io-promise

I/O primitives using promises

```js
  const io = require("io-promise");
```

## Fetch support

```js
 io.fetch("http://www.example.org").then(function (res) {
   return res.text();
  })
```

```js
  io.fetch("http://www.example.com/object.json").then(function (res) {
   return res.json();
  })
```

```js
  io.post("http://www.example.org", {foo: "bar"} ).then(function (res) {
   return res.text();
  })
```

## File API support

```js
  io.readJSON("myfile.json").then(function (data) {
   do something with data;
  })
```

```js
  io.readJSON("myfile.json").then(function (data) {
   do something with data;
  })
```

```js
  io.fetch("http://www.example.org", { delay: 2 } ).then(function (res) {
   return res.text();
  })
```

## Response object

`status` HTTP status code
`url` URL requested
`headers` Object will all of the headers from the HTTP response
`text()` Returns the data as a string
`json()` Returns the data as an object

## Monitoring

```js
  io.monitor(); // active the monitoring
  io.returns an array contains all of the url requested
```

## Caching

Caching of fetch requests

```js
  var cache = new io.Cache("/tmp/");
  cache.load("http://www.example.org").then(function (res) {
    return res.text();
  })
```

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