Rather than have the exporting functionality in the commands/command.js file, the functionality for taking a query/table and putting it into a file should be added to the library functions.
With a modular design, one command could potentially facilitate any number of formats from CSV to JSON and beyond, simply by expanding the library to cope with another format. That way the command stays the same other than adding a parameter to specify what format is needed
Rather than have the exporting functionality in the commands/command.js file, the functionality for taking a query/table and putting it into a file should be added to the library functions.
With a modular design, one command could potentially facilitate any number of formats from CSV to JSON and beyond, simply by expanding the library to cope with another format. That way the command stays the same other than adding a parameter to specify what format is needed