New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

fetchache

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fetchache

Cross Platform Fetch Wrapper with Key Value Cache support

latest
Source
npmnpm
Version
0.1.6
Version published
Weekly downloads
1.5K
4.06%
Maintainers
1
Weekly downloads
 
Created
Source

Fetchache

A fetch wrapper that allows you to respect HTTP caching strategies on non-browser environments with a key-value cache implementation. It follows the HTTP Caching and Conditional Requests standards.

Installation

yarn add fetchache

Usage

import { fetchFactory } from 'fetchache'
import { fetch, Response } from 'some-fetch-impl'

// We recommend using `@whatwg-node/fetch`

const someCacheImpl = {
  get: async key => {
    // Get the cached value from your cache implementation
  },
  set: async (key, value) => {
    // Set the cached value to your cache implementation
  }
}

const fetchWithCache = fetchFactory({
  fetch,
  Response,
  cache
})

// Then you can use it like a normal fetch
const response = await fetchWithCache('https://example.com')

FAQs

Package last updated on 23 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts