# fetch-periodic-sync

> fetch() a URL periodically, with caching & data-saving support.

Latest version **1.1.5** (published 2022-07-18) · ISC license · 0 weekly downloads

## Install

```sh
npm install fetch-periodic-sync
pnpm add fetch-periodic-sync
yarn add fetch-periodic-sync
bun add fetch-periodic-sync
```

## 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.1.5 |
| Published | 2022-07-18 |
| First published | 2020-12-17 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=12 |
| Dependencies | 1 |
| Unpacked size | 6.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Jannis R |
| Maintainers | derhuerst |
| Keywords | fetch, http, sync, interval |

## Links

- npm: https://www.npmjs.com/package/fetch-periodic-sync
- Repository: https://github.com/derhuerst/fetch-periodic-sync
- Issues: https://github.com/derhuerst/fetch-periodic-sync/issues
- npm.io page: https://npm.io/package/fetch-periodic-sync

## Dependencies (1)

- [fetch-ponyfill](https://npm.io/package/fetch-ponyfill.md) ^7.0.0

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 1.1.5 (latest) — 2022-07-18
- 1.1.4 — 2021-01-02
- 1.1.3 — 2021-01-02
- 1.1.2 — 2020-12-17
- 1.1.1 — 2020-12-17
- 1.1.0 — 2020-12-17
- 1.0.0 — 2020-12-17

## README

# fetch-periodic-sync

**[`fetch()`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) a URL periodically, with caching & data-saving support.**

[![npm version](https://img.shields.io/npm/v/fetch-periodic-sync.svg)](https://www.npmjs.com/package/fetch-periodic-sync)
![ISC-licensed](https://img.shields.io/github/license/derhuerst/fetch-periodic-sync.svg)
![minimum Node.js version](https://img.shields.io/node/v/fetch-periodic-sync.svg)
[![support me via GitHub Sponsors](https://img.shields.io/badge/support%20me-donate-fa7664.svg)](https://github.com/sponsors/derhuerst)
[![chat with me on Twitter](https://img.shields.io/badge/chat%20with%20me-on%20Twitter-1da1f2.svg)](https://twitter.com/derhuerst)


## Installation

```shell
npm install fetch-periodic-sync
```


## Usage

```js
const syncViaPeriodicFetch = require('fetch-periodic-sync')

const synced = syncViaPeriodicFetch('https://wikipedia.org/', {
	interval: 5_000,
})

synced.on('error', (err) => {
	console.error('failed to refresh Wikipedia', err)
})
synced.on('change', (res) => {
	// res is a Fetch API Response
	// https://developer.mozilla.org/en-US/docs/Web/API/Response
	res.text().then(console.log)
})
```


## Contributing

If you have a question or need support using `fetch-periodic-sync`, please double-check your code and setup first. If you think you have found a bug or want to propose a feature, use [the issues page](https://github.com/derhuerst/fetch-periodic-sync/issues).

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