Skip to content

Line-by-line stdin with configurable delay and batching

License

Notifications You must be signed in to change notification settings

uRadical/popstr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

popstr

Emit lines from stdin or file with optional delay. A simple Unix-style filter for controlling pipeline flow.

Installation

go install uradical.io/go/popstr@latest

Usage

popstr [flags] [file]

Flags:
  -d, --delay    delay between lines (default: 0s)
  -n, --batch    number of lines to emit at a time (default: 1)
  -j, --jitter   random variation on delay, e.g. 2s means ±2s (default: 0s)
  -h, --help     show help
  -v, --version  show version

Examples

Basic rate limiting:

popstr -d 1s urls.txt | xargs curl

Batch 10 lines at a time with 5 second gaps:

popstr -d 5s -n 10 large-file.txt | process-batch

API calls with jitter to avoid thundering herd:

popstr -d 2s -j 500ms urls.txt | xargs curl

Replay logs at a controlled pace:

popstr -d 10ms production.log | ./my-streaming-processor

Works with stdin:

pbpaste | popstr -d 500ms | xargs curl

Design

  • Zero delay by default (acts as a line buffer)
  • Streams line-by-line, handles arbitrarily large files
  • Passes empty lines through unchanged
  • Exits cleanly on SIGINT/SIGPIPE
  • No dependencies beyond Go stdlib

License

MIT

About

Line-by-line stdin with configurable delay and batching

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages