All Projects → roccomuso → pv

roccomuso / pv

Licence: other
Unix Pipe Viewer (pv) utility in Node.js

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to pv

Trickle
600 baud pipe and terminal.
Stars: ✭ 75 (+275%)
Mutual labels:  unix, utility, pipe
prox
A Scala library for working with system processes
Stars: ✭ 93 (+365%)
Mutual labels:  stream, pipe
Ipt
Interactive Pipe To: The Node.js cli interactive workflow
Stars: ✭ 783 (+3815%)
Mutual labels:  unix, pipe
Rm Protection
A safe alternative for "rm".
Stars: ✭ 416 (+1980%)
Mutual labels:  unix, utility
tpack
Pack a Go workflow/function as a Unix-style pipeline command
Stars: ✭ 55 (+175%)
Mutual labels:  stream, pipe
Lessmd
A small markdown viewer/converter for unix terminal.
Stars: ✭ 122 (+510%)
Mutual labels:  unix, pipe
findlargedir
find all "blackhole" directories with a huge amount of filesystem entries in a flat structure
Stars: ✭ 15 (-25%)
Mutual labels:  unix, utility
Irccat
cat to IRC
Stars: ✭ 91 (+355%)
Mutual labels:  unix, pipe
lwt-pipe
[beta] A multi-consumer, multi-producers blocking queue and stream for Lwt
Stars: ✭ 30 (+50%)
Mutual labels:  stream, pipe
files-io
Read many files with node
Stars: ✭ 19 (-5%)
Mutual labels:  stream, pipe
google-photos-exif
A tool to populate missing `DateTimeOriginal` EXIF metadata in Google Photos takeout, using Google's JSON metadata.
Stars: ✭ 288 (+1340%)
Mutual labels:  utility
ucollage
An extensible command line image viewer inspired by vim
Stars: ✭ 161 (+705%)
Mutual labels:  viewer
cypress-angularjs-unit-test
Unit test Angularjs code using Cypress.io test runner
Stars: ✭ 23 (+15%)
Mutual labels:  utility
Shadbot
A configurable multipurpose bot bringing you music, multiplayer games, moderation commands and more!
Stars: ✭ 48 (+140%)
Mutual labels:  utility
pino-caller
🌲 Include call site of pino log messages
Stars: ✭ 35 (+75%)
Mutual labels:  utility
redtimer
RedTimer - Redmine Time Tracker
Stars: ✭ 59 (+195%)
Mutual labels:  utility
youtube-play
🎵 A command-line utility which streams music from YouTube
Stars: ✭ 47 (+135%)
Mutual labels:  stream
flawesome
Productivity Tool
Stars: ✭ 56 (+180%)
Mutual labels:  utility
fuzzy-sys
Utility tool for using systemctl interactively
Stars: ✭ 106 (+430%)
Mutual labels:  utility
sc2gears
The COMPLETE (!) source code of the Sc2gears universe (Sc2gears app + Sc2gears Database + web-based parsing engine - bundled in an Eclipse project).
Stars: ✭ 30 (+50%)
Mutual labels:  utility

pv

NPM Version Dependency Status JavaScript Style Guide Patreon donate button

Unix Pipe Viewer (pv) utility in Node.js

Pipe viewer is a terminal-based tool for monitoring the progress of data through a pipeline. It can be inserted into any normal pipeline between two processes to give a visual indication of how quickly data is passing through, how long it has taken, how near to completion it is, and an estimate of how long it will be until completion.

Install

$ npm install -g pv

Example usage

$ cat /dev/urandom | pv --size 100MB > /dev/null

Example output:

45.02% | 5 ETA | 42.94MB Transferred | 9.54MB/s

Stats are updated every second.

Available CLI options

  • -s, --size <size>: Assume the total amount of data to be transferred is SIZE. You can provide a size in bytes or using units (b, kb, mb, gb, tb).
  • -N, --name <name>: Prefix the output information with NAME.

Programmatic usage

const PV = require('pv')
const readline = require('readline')

const pv = PV({
  size: /* ... */,
  name: /* ... */,
  time: /* Sets how often progress events are emitted in ms. If omitted then the default is to do so every time a chunk is received. */
})

pv.on('info', function(info){
  readline.clearLine(process.stderr, 0)
  readline.cursorTo(process.stderr, 0, null)
  let {speed, transferred} = info
  process.stderr.write(`Speed: ${speed} - Processed: ${transferred}`)
  
  /*
  {
    name: 'test',
    percentage: 9.05,
    transferred: 949624,
    eta: 42,
    speed: 949624
  }
  */
})

process.stdin.pipe(pv).pipe(process.stdout)

Author

Rocco Musolino (@roccomuso)

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].