npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

freeloader-bundle

v0.0.6

Published

Collecion of streams for freeloader

Downloads

80

Readme

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()