@jawis/stdio-filter
v5.0.0-dev
Published
Filter the stdio from console applications.
Readme
Stdio filter
Makes it possible to take control over the output from scripts, and define what should be shown in the console.
Installation
npm i stdio-filterUsage
echo "hello there" | cfFiles
cf-all.txtThis file will contain all output from the script (filtered, or not). Which is handy if the filtered output was relevant.cf-shown.txtThis file will contain the unfiltered output from the script. Which is handy for reviewing the content that can be filtered.
Configuration
Stdio filter will look for the following configuration in the output folder.
cf-ignore-prefix.txtThe lines in this file will be treated as prefixes, that can be removed from the output.cf-ignore.txtContains content that should be filtered, and hence not shown. Each line defines a line, that can be filtered.includeJson.jsThis file must export a function, that returns true or false for a given object. The object is created by parsing lines that contain json data.includeLine.jsThis function receives each line from the output, and must return a boolean indicating whether to show the line.
Tips
Filter stderr
Stderr is not given to the cf command by default. It's just shown in the
console. But it's possible to redirect stderr to stdout, and then it will be
filtered.
Here is how it's done in bash:
echo "hello there" 2>&1 | cfKnown issues
- Output folder is hardcoded.
Related work
License
MIT
