Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stefanmaric/ntee
Portable Unix shell command 'tee', with some extras - read from standard input and write to standard output and files
https://github.com/stefanmaric/ntee
npm npm-scripts ntee pipe shell stdin stdout tee
Last synced: about 2 months ago
JSON representation
Portable Unix shell command 'tee', with some extras - read from standard input and write to standard output and files
- Host: GitHub
- URL: https://github.com/stefanmaric/ntee
- Owner: stefanmaric
- License: mit
- Created: 2015-06-17T00:40:23.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2019-05-25T23:06:16.000Z (over 5 years ago)
- Last Synced: 2024-11-06T00:39:23.320Z (3 months ago)
- Topics: npm, npm-scripts, ntee, pipe, shell, stdin, stdout, tee
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/ntee
- Size: 12.7 KB
- Stars: 23
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# 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:
```json
{
"scripts": {
"less": "lessc main.less | postcss --use autoprefixer | ntee main.css | cleancss > main.min.css"
}
}
```## Install
```shell
$ npm install -g ntee
```## Check
```shell
$ ntee --help
```## Use
```
Usage:
ntee [OPTION]... FILE...Copy standard input to each FILE, and also to standard output.
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
``````shell
$ 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 exist, they will be overwritten. Use `-a`/`--append` to avoid it, just like you would do with Richard Stallman's `tee`:
```shell
$ 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:
```shell
$ echo "Nothing will be shown in screen" | ntee -s but-it-will-be-saved-here.txt
```You can always pipe:
```shell
cat long.log | sort | ntee sorted.log | head
```## License
[MIT](./LICENSE.md) ♥