Efficiency

Option 1:

if (output === 'file') {
    file.write (...)
} else if (output === 'console') {
    console.log (...)
}

Option 2:

fd.write (...)

Option 2 will be more efficient than option 1, regardless of whether you implement the code in a language like Rust or C++

See Also

Bloatware Reduction Case Study

Table of Contents
Blog
Videos
References
Books