mashaal / koa-vault

πŸ— Archive Koa responses, for historical purposes.

Home Page:https://www.npmjs.com/package/koa-vault

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

πŸ— Koa Vault

Archive Koa responses, for historical purposes.

This project will save JSON responses to a local directory, which can be later used when the API is decommissioned. Read about why this project was created here.

Could be used with koa-proxy to scrape arbitrary API's.

Installation

yarn add koa-vault

Usage

// ecmascript module
import vault from 'koa-vault'

// commonjs
const vault = require('koa-vault')

app.use(
  vault({
    directory: './vault', // default
    offline: false //default
  })
)

Saved files

β†’ program β†’ mulatu-astatke.json
β†’ program β†’ nakhane.json
β†’ program β†’ neneh-cherry.json
β†’ program β†’ oneohtrix-point-never.json

JSON files will be saved to the vault directory. Due to file naming conventions, forward slashes are replaced with forward arrows (β†’), and question marks with question blocks (β–‘).

Only GET requests with application/json content-type header responses will be saved. If this does not suit your needs, please open a pull request.

Offline/archive

When turning the offline option on, GET requests will be served from the vault directory. If the file does not exist, a 404 error will be thrown.

About

πŸ— Archive Koa responses, for historical purposes.

https://www.npmjs.com/package/koa-vault


Languages

Language:JavaScript 100.0%