1.0.2 • Published 3 years ago

restractor v1.0.2

Weekly downloads
4
License
MIT
Repository
github
Last release
3 years ago

restractor

GitHub code size in bytes GitHub package.json version GitHub js-semistandard-style

A library and CLI to extract and restore data from REST api's.

Installation

npm install --save restractor

Usage

CLI

# Download from a rest endpoint and save to a file
restractor http://localhost:42597/notes ./notes.json

# Download from a file and post to a rest endpoint
restractor notes.json http://localhost:42597/notes1

# Download from a rest endpoint and post to another rest endpoint
restractor http://localhost:42597/notes http://localhost:42597/notes1

# Use authenticated tls on source
restractor \
  --source-key=./certs/localhost.privkey.pem \
  --source-cert=./certs/localhost.cert.pem \
  --source-ca=./certs/ca.cert.pem \
  https://localhost:8061/services \
  ./services.json

# Use authenticated tls on destination
restractor \
  --dest-key=./certs/localhost.privkey.pem \
  --dest-cert=./certs/localhost.cert.pem \
  --dest-ca=./certs/ca.cert.pem \
  https://localhost:8061/services \
  ./services.json

Extracting data

const fs = require('fs');
const restractor = require('restractor');

restractor.extract('http://localhost:8000/api/notes', function (error, notes) {
  fs.writeFileSync('./notes.json', notes);
});

Restoring data

const fs = require('fs');
const restractor = require('restractor');

const notes = fs.readFileSync('./notes.json', 'utf8');
restractor.restore(notes, 'http://localhost:8000/api/notes');
1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago