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

do-you-bench

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

do-you-bench - npm Package Compare versions

Comparing version 2.1.2 to 3.0.0

31

config/prompts.js

@@ -6,3 +6,3 @@ module.exports = [

message: "Enter the number of requests (Int)",
default: 10
default: 10,
},

@@ -13,3 +13,3 @@ {

message: "Specify the number of concurrent requests (Int)",
default: 1
default: 1,
},

@@ -21,9 +21,22 @@ {

choices: ["http", "https"],
default: "http"
default: "http",
},
{
name: "hostname",
name: "method",
type: "list",
message: "Please choose the Method of the request",
choices: ["GET", "POST"],
default: "GET",
},
{
name: "postfile",
type: "input",
message: "Please specify a host name",
validate: function(val) {
message: "Please specify the post data file",
when: (answers) => answers.method === "POST",
},
{
name: "domain",
type: "input",
message: "Please specify the domain name",
validate: function (val) {
if (val.length) {

@@ -34,3 +47,3 @@ return true

}
}
},
},

@@ -41,4 +54,4 @@ {

message: "Please specify a path",
default: ""
}
default: "",
},
]
{
"name": "do-you-bench",
"version": "2.1.2",
"version": "3.0.0",
"description": "Simple interactive http[s] benchmarking tool",

@@ -5,0 +5,0 @@ "main": "cli.js",

@@ -48,3 +48,3 @@ <div align="center">

- [x] GET
- [ ] POST
- [x] POST

@@ -51,0 +51,0 @@

const inquirer = require("inquirer")
const promptQuestion = question => {
const promptQuestion = (question) => {
return inquirer.prompt(question)

@@ -8,3 +8,3 @@ }

module.exports = {
promptQuestion
promptQuestion,
}
const shell = require("shelljs")
const executeShell = cmd => {
const executeShell = (cmd) => {
shell.exec(cmd)

@@ -8,10 +8,18 @@ }

const generateCommand = (input = {}) => {
return `ab -n ${input.requests} -c ${input.concurrency} ${input.protocol}://www.${
input.hostname
}/${input.path}`
let command = `ab -n ${input.requests} -c ${input.concurrency} `
if (input.postfile) {
command = `${command} -p ${input.postfile} -H 'accept: application/json' -H 'Content-Type: application/json' `
}
return `${command} ${input.protocol}://${input.domain}/${replaceAll(input.path, "/", "")}/`
}
function replaceAll(string = "", character = "", replace = "") {
return string.split(character).join(replace)
}
module.exports = {
executeShell,
generateCommand
generateCommand,
}

@@ -9,3 +9,3 @@ const { generateCommand } = require("../src/execute")

hostname: "revix.com",
path: ""
path: "",
}

@@ -23,3 +23,3 @@

hostname: "revix.com",
path: ""
path: "",
}

@@ -26,0 +26,0 @@

Sorry, the diff of this file is not supported yet

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