Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

got-cached

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

got-cached - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

build/coverage/coverage.json

6

build/index.js

@@ -58,6 +58,4 @@ 'use strict';

var response = setCache(url, (0, _got2.default)(url, options));
// return got response for non-cached requests
return response;
// return got response but first set cache with it
return setCache(url, (0, _got2.default)(url, options));
});

@@ -64,0 +62,0 @@

{
"name": "got-cached",
"version": "1.0.0",
"version": "1.0.1",
"description": "Got response cache for get requests",

@@ -5,0 +5,0 @@ "author": "janneh",

got-cached
=====================
Got cached is a provider of a cache wrapper around got (for http GET requests).
Cache is expected to to have functions `set(key, value)` and `get(key)`
(returning a Promise that resolves the value).
Got cached provides a cache wrapper around `got`
note: cache hits only include `response.status` (200) and `response.body`
## Install
```
$ npm install --save got-cached
```
## Usage
`gotChached` takes options that should include a cache object
that is expected to to have the functions `set(key, value)` and `get(key)`
(returning a Promise that resolves the value).
Below is an example using `then-redis` to cache with a 10 minute expiry
```
import fs from 'fs'

@@ -29,5 +41,2 @@ import { createClient } from 'then-redis'

})
// Streams are not cached, but still play nicely
got.stream('todomvc.com').pipe(fs.createWriteStream('index.html'))
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc