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

freeloader-bundle

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

freeloader-bundle

Collecion of streams for freeloader

  • 0.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
11
increased by175%
Maintainers
1
Weekly downloads
 
Created
Source

freeloader-bundle

Travis CI status

Collection of streams for freeloader. They're roughly divided into 3 categories:

All these modules are Node.js Transform streams, so you can also easily create your own.


times(count)

Emits count requests for each incoming request.

Example:

emit(r)
.pipe(times(5))
.send()

perSecond(count)

Emits count requests per second for each incoming request. This emitter only stops when you press Ctrl-C or when a downstream module requests a shutdown.

Example:

emit(r)
.pipe(perSecond(10))
.send()

Note: the emitter can push out thousands of requests per second, but you will most likely be limited by the local network bottlneck.

concurrent(count)

Maintains count requests in flight for each incoming request. This emitter only stops when you press Ctrl-C or when a downstream module requests a shutdown.

This is the equivalent of threads in JMeter.

Example:

emit(r)
.pipe(concurrent(50))
.send()

transform(fn)

Applies the fn function to every incoming request. For example, the function can add headers or modify the payload.

Example:

function randomId(req) {
  req.body.myId = Math.floor(Math.random() * 1000);
}

emit(r)
.pipe(times(1000))
.pipe(transform(randomId))
.send()

stopTimer(duration)

Stop sending any more requests after duration. This module needs to be downstream of any emitting module, since the pause event bubbles up.

duration is a human readable string like 5s, 20s, 3m, 1h.

Example:

emit(r)
.pipe(perSecond(5))
.pipe(stopTimer('10s'))
.send()

Note: this does not terminate the pipeline immediately. It simply asks upstream modules to stop sending requests. The shutdown can take a few seconds if modules are still waiting for responses to arrive (ex: consoleSummary).

stopCount(count)

Shuts down the pipeline after count requests have gone through. This module needs to be downstream of any emitting module, since the pause event bubbles up.

duration is a human readable string like 5s, 20s, 3m, 1h.

Example:

emit(r)
.pipe(perSecond(5))
.pipe(stopCount(30))
.send()

Note: this does not terminate the pipeline immediately. It simply asks upstream modules to stop sending requests. The shutdown can take a few seconds if modules are still waiting for responses to arrive (ex: consoleSummary).

print()

Prints every request and response as they arrive. This is useful for debugging, but usually too verbose for actual load tests.

Example:

emit(r)
.pipe(print())
.send()

requestDots()

Prints a dot for every request going through, as a way to track progress.

Example:

emit(r)
.pipe(requestDots())
.send()

responseDots()

For every response that comes back, prints a green 'o' (success) or a red 'x' (failure).

Example:

emit(r)
.pipe(responseDots())
.send()

periodicSnapshot(millis)

Prints the state of the test to the console every millis milliseconds. This includes total requests count, response count, and number of requests in flight.

Example:

emit(r)
.pipe(periodicSnapshot(1000))
.send()

consoleSummary()

Prints useful statistics to the console once all the responses have arrived, including the average response times.

Example:

emit(r)
.pipe(consoleSummary())
.send()

jsonSummary(path)

Similar to consoleSummary, but prints the statistics to a file. This is useful to integrate into a CI pipeline.

Example:

emit(r)
.pipe(jsonSummary('test-report.json'))
.send()

consoleCharts()

Prints bar charts to the console once the test has finished (response time distribution, ...).

Example:

emit(r)
.pipe(consoleCharts())
.send()

callback(fn)

Calls the fn function once the test is finished. The function will be called with an Error if any of the requests failed.

Example:

function done(err) {
  console.log(err ? ('Test failed: ' + err) : 'Success');
}

emit(r)
.pipe(callback(done))
.send()

then(fnSuccess, fnFailure)

Promise-like API for when the test has finished. Will call fnSuccess if all the requests were successful, and fnSuccess if there were any errors.

Example:

function success() {
  console.log('Success!');
}

function failure() {
  console.log('Failure:', err);
}

emit(r)
.pipe(then(success, failure))
.send()

Keywords

FAQs

Package last updated on 22 Feb 2014

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