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

autocannon-storage

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

autocannon-storage

A utility for storing and sorting autocannon results

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by200%
Maintainers
1
Weekly downloads
 
Created
Source

banner

Autocannon-storage

A utility module for storing autocannon results in s3 and sorting/retrieving them in useful manners.

Usage

Command-line

Usage: autocannon-storage {command} [opts]

A convenient command-line library for storing autocannon results in S3

Available commands:
  save
    Save autocannon results to s3
  load
    Load autocannon results from s3 and output them as ndjson

Available options:

  -i/--input FILE
        The path to some json results to save. Required when not piping into this tool.
  -o/--output DIRECTORY
        The path to some directory to save results in. Will save results in `${result.finish}.json`
  -c/--credentials FILE
        The path to some json file with S3 credentials
  -k/--accessKey S3_ACCESS_KEY
        Some S3 access key
  -K/--secretKey S3_SECRET_KEY
        Some S3 secret key
  -b/--bucket NAME
        The title of some S3 bucket
  -a/--amount AMOUNT
        The amount of results to load
  -t/--tag TAG
        A semver version tag to tag the results with if doing a save.
        An NPM version tag to filter results by if doing a load.
  -v/--version
        Print the version number.
  -h/--help
        Print this menu.

Example

saving

autocannon -d 30 -j localhost:3000 | autocannon-storage save -c ./s3Credentials.json -t `node -e "console.log(require('./package.json').version)"`

loading

autocannon-storage load -c ./s3Credentials.json -t ">=1.0.0" | autocannon-reporter

Programmatically

'use strict'

const storage = require('autocannon-storage')
const abstractBlobStore = require('abstract-blob-store')
const autocannonResults = require('./SOME_AUTOCANNON_RESULTS')

storage.createStore(abstractBlobStore, function (err, store) {
  store.save(autocannonResults, function (error) {
    // ...
  })
  store.load({}, function (error, results) {
    // ...
  })
})

API

createStore(store, callback)

Creates an autocannon-storage store that wraps around some library that the implements abstract-blob-store api

  • store: An object that implements the abstract-blob-store API
  • callback(err, store): the callback that is called when the store is instantiated. This takes an error and store as parameters. The store implements the store api described below.

Store API

An autocannon store object is passed in the callback of the createStore, and it wraps an abstract-blob-store library. It has the following methods.

store.save(results, cb, metadata)

This takes autocannon results and saves it in the store. These results can also have an added tag attribute with semver tags for utilty filtering later.

The callback takes error and metadata parameters for utility purposes.

store.load(opts, cb)

This takes a set of options and loads results matching those params from the store.

The callback takes error and results parameters.

  • opts.amt: The amount of results to load
  • opts.sort: a sorting function which is used to sort results before returning. defaults to sorting by most recent finish time in the autocannon results

store.filter(opts, cb)

This takes a set of options and filters results to matching those params from the store.

The callback takes error and results parameters.

  • opts.filter: A filter function which should return true if some metadata passed to it should be included in the downloaded results. Can be used to filter by tags.
  • opts.amt: The amount of results to load
  • opts.sort: a sorting function which is used to sort results before returning. defaults to sorting by most recent finish time in the autocannon results

Utility

createS3Store(credentials, bucket)

A wrapper around s3-blob-store that creates and returns that store when passed valid credentials and a bucket name

Valid credentials have accessKey and secretKey attributes. Used by the command line functionality.

Acknowlegements

Sponsored by nearform

License

MIT.

Keywords

FAQs

Package last updated on 28 Jul 2016

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

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