Show Images in Console with Node.js console-png

By  on  

Introducing colors into the command line makes console reading much easier which is why finding Chalk was a life-changing event for me.  I started digging deeper  into making the console more graphical and I found another module that could bring the console to life:  console-png!

The JavaScript

Assuming you've installed console-png or grabbed it from GitHub, it doesn't take much to output an image to the console:

// Attach module to the console
require('console-png').attachTo(console);

// Read the image, let console-png output it to console
console.png(require('fs').readFileSync(__dirname + '/logo.png'));

As for the use case of such a module, there probably aren't a ton.  It would be useful to show a command line splash screen when an app starts up, and it may be useful as a feedback mechanism as the user follows app flow.

Recent Features

Incredible Demos

  • By
    MooTools FontChecker Plugin

    There's a very interesting piece of code on Google Code called FontAvailable which does a jQuery-based JavaScript check on a string to check whether or not your system has a specific font based upon its output width. I've ported this functionality to MooTools. The MooTools...

  • By
    Create a Download Package Using MooTools Moousture

    Zohaib Sibt-e-Hassan recently released a great mouse gestures library for MooTools called Moousture. Moousture allows you to trigger functionality by moving your mouse in specified custom patterns. Too illustrate Moousture's value, I've created an image download builder using Mooustures and PHP. The XHTML We provide...

Discussion

  1. After your article on promises, I’m sad this is using callbacks!

  2. Instead of joining the dirname and filename with string concatenation, you should use the node path joiner so it will work on windows too :)

  3. I like where this is going!

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!