# stubrec

> record stub json file

Latest version **0.4.1** (published 2020-05-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install stubrec
pnpm add stubrec
yarn add stubrec
bun add stubrec
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.1 |
| Published | 2020-05-11 |
| First published | 2014-05-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 11 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | yosuke-furukawa |
| Maintainers | yosuke-furukawa |
| Keywords | stub, record, json |

## Links

- npm: https://www.npmjs.com/package/stubrec
- Repository: https://github.com/yosuke-furukawa/stubrec
- Issues: https://github.com/yosuke-furukawa/stubrec/issues
- npm.io page: https://npm.io/package/stubrec

## Dependencies (2)

- [mkdirp](https://npm.io/package/mkdirp.md) ^1.0.4
- [str-stream](https://npm.io/package/str-stream.md) ^0.1.2

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.4.1 (latest) — 2020-05-11
- 0.3.0 — 2014-08-21
- 0.2.3 — 2014-05-26
- 0.2.2 — 2014-05-23
- 0.2.1 — 2014-05-23
- 0.2.0 — 2014-05-23
- 0.1.1 — 2014-05-23
- 0.1.0 — 2014-05-23

## README

Stubrec [![Build Status](https://travis-ci.org/yosuke-furukawa/stubrec.svg?branch=master)](https://travis-ci.org/yosuke-furukawa/stubrec)
===============

Stubrec records json file and proxy request and response.

Usage
===============

```sh
$ npm install stubrec -S
```

```javascript
var Stubrec = require('stubrec');
var stubrec = new Stubrec({
  // proxy property specifies backend server
  proxy : "http://localhost:3001", 
  // debug print on
  debug : true
});
var http = require("http");

http.createServer(function(req, res){
    //record to ./test/test.json
    stubrec.record("./test/test.json", req, res);
}).listen(3000);

http.createServer(function(req, res){
    res.writeHead(200, {'Content-Type': 'application/json'});
    res.end('{"hello":"world"}');
}).listen(3001);

http.get("http://localhost:3000/", function(res){
    var data = '';
    res.on("data", function(chunk){
      data += chunk;
    });
    res.on("end", function(){
      // {"hello":"world"}
      console.log(data);
      done();
    });
});

```

---
_Source: https://npm.io/package/stubrec · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
