Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on May 8, 2024 via pnpm

cacheable-request 10.2.13

Wrap native HTTP requests with RFC compliant cache support
Package summary
Share
0
issues
2
licenses
9
MIT
1
BSD-2-Clause
Package created
2 Jun 2017
Version published
26 Jul 2023
Maintainers
3
Total deps
10
Direct deps
7
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
9 Packages, Including:
@types/http-cache-semantics@4.0.4
cacheable-request@10.2.13
get-stream@6.0.1
json-buffer@3.0.1
keyv@4.5.4
lowercase-keys@3.0.0
mimic-response@4.0.0
normalize-url@8.0.1
responselike@3.0.0

BSD 2-Clause "Simplified" License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
place-warranty
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
http-cache-semantics@4.1.1
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

7
All Dependencies CSV
β“˜ This is a list of cacheable-request 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
@types/http-cache-semantics4.0.43.64 kBMIT
prod
get-stream6.0.14.17 kBMIT
prod
http-cache-semantics4.1.110.56 kBBSD-2-Clause
prod
keyv4.5.48.42 kBMIT
prod
mimic-response4.0.02.68 kBMIT
prod
normalize-url8.0.125.25 kBMIT
prod
responselike3.0.02.16 kBMIT
prod

Visualizations

Frequently Asked Questions

What does cacheable-request do?

Cacheable-Request is a popular npm package used to wrap native HTTP requests with RFC compliant cache support. It enables you to add caching capabilities to native Node.js HTTP/HTTPS requests in compliance with RFC 7234. This package works out of the box in memory, or you can easily plug in various storage adapters. What's great about it is that it only stores cacheable responses defined by RFC 7234, provides support for a broad variety of storage adapters, and it automatically bypasses the cache if DB connection fails.

How do you use cacheable-request?

To use Cacheable-Request, you first need to install it via npm using npm install cacheable-request. After that, you can import it in your code and wrap your http request with cache support as shown in the following example:

import http from 'http';
import CacheableRequest from 'cacheable-request';

// Instead of
const req = http.request('http://example.com', cb);
req.end();

// Wrap the request with cache support
const cacheableRequest = new CacheableRequest(http.request).createCacheableRequest();
const cacheReq = cacheableRequest('http://example.com', cb);
cacheReq.on('request', req => req.end());

In the above example, future requests to example.com will be returned from cache if still valid.

This package also allows you to add additional request methods that are API compatible, such as https.request and electron.net, and wrap them with cache support as follows:

const cacheableRequest = new CacheableRequest(https.request).createCacheableRequest();
const cacheableRequest = new CacheableRequest(electron.net).createCacheableRequest();

Also, you can add hooks to modify responses before saving them in the cache.

Where are the cacheable-request docs?

The cacheable-request docs and further information about the package can be found in its GitHub page: Cacheable-Request GitHub. The documentation includes its latest changes, installation and usage guidelines, API details, information on how to use hooks, and more. If you want to contribute, ask questions or report issues, guidelines and protocols are provided as well.