Show Images in Console with Node.js console-png
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.
Sooner or later you'll run across a regular expression. With their cryptic syntax, confusing documentation and massive learning curve, most developers settle for copying and pasting them from StackOverflow and hoping they work. But what if you could decode regular expressions and harness their power? In...
Many of the new APIs provided to us by browser vendors are more targeted toward the mobile user than the desktop user. One of those simple APIs the Vibration API. The Vibration API allows developers to direct the device, using JavaScript, to vibrate in...
AJAX has become a huge part of the modern web and that wont change in the foreseeable future. MooTools has made AJAX so simple that a rookie developer can get their dynamic pages working in no time.
Step 1: The XHTML
Here we define two links...
One of the reasons I love AJAX technology so much is because it allows us to avoid unnecessary page loads. Why download the header, footer, and other static data multiple times if that specific data never changes? It's a waste of time, processing, and bandwidth. Unfortunately...
After your article on promises, I’m sad this is using callbacks!
Agreed (I didn’t create it). But they could add https://davidwalsh.name/promises-callbacks-promisifynode !
Instead of joining the dirname and filename with string concatenation, you should use the node path joiner so it will work on windows too :)
I like where this is going!