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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@space48/json-pipe

v0.4.16

Published

A tiny library for creating JSON pipeline CLI programs

Readme

@space48/json-pipe

A powerful TypeScript library for building JSON processing pipelines with async iterables. This library makes it easy to create efficient command-line programs that process JSON data through a series of transformations, with support for streaming and backpressure.

Features

  • Process JSON data streams using async iterables
  • Rich set of transformation operators:
    • map and mapAsync with configurable concurrency
    • flatMap and flatMapAsync for nested transformations
    • filter for conditional processing
    • distinct for deduplication
    • groupBy and groupWhile for data aggregation
    • batch for processing items in chunks
    • take and takeWhile for limiting output
    • reduce for aggregating results
  • Built-in support for reading/writing JSON Lines format
  • Composable transformations using pipe and compose
  • Efficient streaming with backpressure handling
  • Written in TypeScript with full type safety
  • Node.js 8+ compatible

Installation

npm install @space48/json-pipe

Beta Versions

To install the latest beta version:

npm install @space48/json-pipe@beta

Beta versions are automatically published:

  • When code is pushed to the develop branch (version format: x.y.z-beta.commit-hash)
  • When a pull request is opened against master (version format: x.y.z-beta.pr.number)

Usage

Basic Example

import { pipe, readJsonLinesFrom, writeJsonLinesTo, map } from '@space48/json-pipe';

// Read JSON Lines from stdin, transform them, and write to stdout
await pipe(
  readJsonLinesFrom(process.stdin),
  map(data => {
    // Your transformation logic here
    return transformedData;
  }),
  writeJsonLinesTo(process.stdout)
);

Parallel Processing

import { pipe, mapAsync } from '@space48/json-pipe';

// Process items concurrently
const transform = mapAsync(
  { concurrency: 5 }, // Process 5 items at a time
  async item => {
    // Async transformation logic
    return processedItem;
  }
);

Data Aggregation

import { pipe, groupBy, batch } from '@space48/json-pipe';

// Group items by a key
const groupedTransform = pipe(
  input,
  groupBy(item => item.category),
  // Process in batches of 100
  batch(100)
);

API Reference

Core Functions

  • pipe(...fns): Compose multiple transformations
  • compose(...fns): Compose functions from right to left
  • map(fn): Transform each item
  • mapAsync(options, fn): Transform items asynchronously with concurrency control
  • flatMap(fn): Transform and flatten results
  • flatMapAsync(options, fn): Transform and flatten asynchronously
  • filter(predicate): Filter items based on a predicate
  • distinct(compare?): Remove duplicates
  • groupBy(getKeyFn): Group items by key
  • batch(size): Process items in batches
  • take(n): Limit number of items
  • reduce(fn, initialValue?): Aggregate items

I/O Functions

  • readJsonLinesFrom(source): Read JSON Lines from a readable stream
  • writeJsonLinesTo(destination): Write JSON Lines to a writable stream
  • readLinesFrom(source): Read lines from a readable stream

Requirements

  • Node.js >= 8
  • TypeScript (for development)

Development

  1. Clone the repository:
git clone https://github.com/Space48/json-pipe.git
  1. Install dependencies:
npm install
  1. Build the project:
npm run build

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

For bug reports and feature requests, please open an issue on the GitHub repository.


Maintained by Space48