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

couchgenerator

v0.1.2

Published

Automatic database workload creator

Downloads

7

Readme

couchgenerator

A simple CouchDB data generation tool. Generates a stream of user document inserts, updates and deletes to a nominated database. A random batch size is chosen. Approximately 5% of the batch will be updates, 5% deletes and 90% inserts.

Handy if you're testing a CouchDB changes feed.

Installation

You'll need Node.js & npm. Then run:

npm install -g couchgenerator

Usage

couchgenerator needs to know your CouchDB URL (including access credentials) and the database name you want to write to. They can be supplied either by environment variables of command-line parameters or a mix of both.

Command-line parameters

  • --url/-u - the URL of the CouchDB instance e.g. http://admin:mypassword@localhost:5984
  • --database/--db/-d - the name of the database to write to e.g. users
  • --template/-t - the path of template file e.g. ./mytemplate/products.json
couchgenerator --url 'http://admin:mypassword@localhost:5984' --db users
2022-05-27T12:53:08.896Z { inserts: 295, updates: 0, deletes: 0, ops: 295 }
2022-05-27T12:53:10.001Z { inserts: 247, updates: 10, deletes: 16, ops: 568 }
2022-05-27T12:53:11.134Z { inserts: 331, updates: 21, deletes: 14, ops: 934 }

Environment variables

  • COUCH_URL
  • COUCH_DATABASE
export COUCH_URL='http://admin:mypassword@localhost:5984'
couchgenerator --db users
2022-05-27T12:53:08.896Z { inserts: 295, updates: 0, deletes: 0, ops: 295 }
2022-05-27T12:53:10.001Z { inserts: 247, updates: 10, deletes: 16, ops: 568 }
2022-05-27T12:53:11.134Z { inserts: 331, updates: 21, deletes: 14, ops: 934 }

Programmatic usage

const couchgenerator = require('couchgenerator')
await couchgenerator({ url: MYURL, db: MYDB, template: './mytemplate.txt' })

Using a custom document template

By default, couchgenerator creates documents that look like users. If you want to fill a database with other data types, then simply create a template file template.txt:

{
  "_id": "{{uuid}}",
  "name": "{{name}}",
  "email": "{{email}}"
}

and pass the path to the file as the --template parameter:

couchgenerate --db products --template './path/to/template.txt'

The tags you can use to generate data values are listed in the datamaker README.