The Pnyx library contains everything needed to quickly build software for processing files. It is a stand-alone library (no dependences) with a fluent API. The API is simple to use and easily extended. All of the software is open-source and can be viewed on GitHub: pnyx.net.
Install-Package pnyx.net
Pnyx
class. It is a state-based builder for creating
sequences of filtering and transforms. The following is a simple line-transform and line-filter example:
using (Pnyx p = new Pnyx()) { p.readString("Hello World."); p.sed("World", "World, with love from Pnyx.."); // transforms each line p.grep("world", caseSensitive: false); // filters each line p.writeStdout(); p.compile(); // Builds processors and wires filters together p.process(); // Runs processors (All IO is done here) } // outputs: Hello World, with love from Pnyx...
compile
and process
steps
are required. However, by default, when Pnyx is disposed, it will automatically run the compile
and process
steps. Here is an example of the
minimum required calls:
using (Pnyx p = new Pnyx()) { p.readString("Minimum"); p.writeStdout(); } // outputs: Minimum
compile
and process
steps. For some use-cases it may to desirable to
require an explicit call to process
. In those cases, set processOnDispose
to false and the disposing will not automatically process.
See Settings for more information.