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

datagen

v1.0.1

Published

Multi-process test data files generator

Downloads

76

Readme

Build Status Dependencies Status Coverage Status Published Version npm Badge

DataGen

DataGen is a multi-process test data files generator.

This is handy when you want to generate large test data files (e.g. XMLs, JSONs, CSVs, etc), over multiple processes, utilising available CPU cores on your machine. It's also very easy to generate random numbers, dates, and strings as test data. You only need to create template files, no scripting involved.

Installation

npm install -g datagen 

Usage

Create example header, segment, and footer template files:

datagen init

Generate 8 data files containing 1 million segments in each file, written to data1 ... data8 output files, running over 8 processes, each process is used to generate 1 file:

datagen gen -s 1000000 -w 8 -o data

Limit the number of worker processes that can run concurrently to just 3:

datagen gen -s 1000000 -w 8 -m 3

Templates

DataGen uses three template files: header, segment, and footer. These templates are simple text files which are used to construct a data file in this format:

header
segment 1
segment 2
...
segment N (number of segments)
footer

Example header:

<?xml version="1.0" encoding="UTF-8"?>
<data>

Example segment:

<segment>
  <id>{gen_id}-{worker_id}-{segment_id}</id>
  <name>{first_name()} {last_name()}</name>
  <dob>{date('dd-mm-yyyy')}</dob>
</segment>

Example footer:

</data>

The above templates will generate an XML like this:

<?xml version="1.0" encoding="UTF-8"?>
<data>
<segment>
  <id>1-1-1</id>
  <name>Niels Bryant</name>
  <dob>12-08-1992</dob>
</segment>
<segment>
  <id>1-1-2</id>
  <name>John Bohr</name>
  <dob>01-11-1970</dob>
</segment>
...
</data>

Curly brackets in templates (e.g. JSON format) need to be escaped with double brackets:

{{ "id": "{gen_id}-{worker_id}-{segment_id}", "name": "{first_name()} {last_name()}", "dob": "{date('dd-mm-yyyy')}" }}

Templates can contain the following parameters:

Screenshots

Command init Command gen with flags

Colophon

Developer's Guide

Build reports:

Articles: