aitbw / ntee

Portable Unix shell command 'tee', with some extras - read from standard input and write to standard output and files

Home Page:https://www.npmjs.com/package/ntee

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ntee

Portable Unix shell command tee, with some extras - read from standard input and write to standard output and files.

TL;DR

gulp.dest() in middle of a pipe? NPM scripts can do as well:

{
  "scripts": {
    "less": "lessc main.less | postcss --use autoprefixer | ntee main.css |  cleancss > main.min.css"
  }
}

Install

$ [sudo] npm install -g ntee

Check

$ ntee --help

Use

ntee [OPTIONS] [FILE]

Options:
  -a, --append           append to the given FILEs, do not overwrite
  -i, --ignore-interrupts ignore interrupt signals
  -s, --suppress         do NOT output to stdout
  -v, --version          Display the current version
  -h, --help             Display help and usage details
$ whoami | ntee file1.txt file2.txt

Will print current user to stdout and also to file1.txt and file2.txt. Note that if these files already existed, they will be overwritten. Use -a/--append to avoid it, just like you would do with Richard Stallman's tee:

$ whoami | ntee -a i-wont-be-overwritten.txt

-i/--ignore-interrupts will prevent CTRL+C from killing ntee. Won't work on windows.

I also added an -s/--suppress option to suppress output to stdout. This meant to be used on npm scripts:

$ echo "Nothing will be shown in screen" | ntee -s but-it-will-be-saved-here.txt

You can always pipe:

cat long.log | sort | ntee sorted.log | head

License

MIT

About

Portable Unix shell command 'tee', with some extras - read from standard input and write to standard output and files

https://www.npmjs.com/package/ntee

License:MIT License


Languages

Language:JavaScript 100.0%