open-index/open-npm huggingface dataset:
npm package: @jacraig/request
Description: Wrapper around fetch that adds functionality including caching, retry, and timeouts.
Author: James Craig
Latest version: 1.5.5

# @jacraig/request

[![NPM Publish](https://github.com/JaCraig/request/actions/workflows/node-publish.yml/badge.svg)](https://github.com/JaCraig/request/actions/workflows/node-publish.yml)

`@jacraig/request` is a powerful yet lightweight library designed to simplify HTTP requests using the native `fetch` API while adding functionality such as caching, retry logic, and timeouts. It aims to provide developers with a convenient and flexible solution for handling HTTP requests in JavaScript and TypeScript applications.

## Features

- **Caching**: Cache responses to improve performance and reduce network requests.
- **Retry logic**: Automatically retry failed requests with customizable retry options.
- **Timeouts**: Set timeouts for requests to prevent hanging and improve overall application responsiveness.

## Installation

You can install `@jacraig/request` via npm:

```bash
npm install @jacraig/request
```

## Usage

Here's a basic example of how you can use `@jacraig/request` to make a fetch request:

```typescript

import { Request } from '@jacraig/request';

let returnValue = await Request.get('https://jsonplaceholder.somewhere.com/post.json').send();

```

In order to use caching, retry logic, or timeouts, you can use the extra methods on the returned Request object to set options:

```typescript

import { Request, StorageMode } from '@jacraig/request';

let returnValue = await Request.get('https://jsonplaceholder.somewhere.com/post.json')
    .withStorageMode(StorageMode.StorageAndUpdate)
    .withTimeout(5000)
    .withRetryAttempts(3)
    .send();

```

If you prefer to use callbacks instead of promises, you can do so by passing a callback function to the `onSuccess` method:

```typescript

import { Request } from '@jacraig/request';

Request.get('https://jsonplaceholder.somewhere.com/post.json')
    .onSuccess((response) => {
        console.log(response);
    })
    .send();

```

## Documentation
For more detailed information on how to use `@jacraig/request`, please refer to the [documentation](https://jacraig.github.io/request/) on GitHub Pages.

## License
@jacraig/request is licensed under the [Apache 2.0 License](https://github.com/JaCraig/request/blob/main/LICENSE)
npm package: @jad3n/system-ca
Description: Access the system certificate store on Windows, macOS and Linux
Latest version: 1.0.2

# system-ca

Access the system certificate store on Windows, macOS and Linux.

```js
import { systemCertsSync, systemCertsAsync } from 'system-ca';

console.log(systemCertsSync())
console.log(await systemCertsAsync())

tls.connect({
  host: 'google.com',
  port: 443,
  ca: await systemCertsAsync({ includeNodeCertificates: true })
})
```

The `systemCertsSync()` and `systemCertsAsync()` functions perform the same
operation, namely, listing all trusted certificates as an array of PEM-formatted
X.509 certificates.

The result can be passed directly to the `ca` option of `tls.connect()`
and similar methods.

- Using `systemCertsAsync()` may be preferable, because accessing the
  system store can be slow, especially on Windows.
- `systemCertsAsync()` uses a worker thread under the hood on Windows and macOS.
- On Windows and macOS, this package always uses native addons for accessing
  the system certificate store.
- On all other platforms, both the async and the sync variant read from the
  typical system locations for storing trusted certificates (i.e. `/etc/ssl`, `/etc/pki`).

## LICENSE

Apache-2.0