Join other SaaS builders and get in depth technical content to help build your SaaS.
By Will Laurance on 07/11/2013
Charm is a module used to write colors and cursor positions to a stream.
Let's build a simple progress indicator with charm.
npm install charm
Using setTimeout to write a charm bar. Because charm bar writes using the stream interface, using a blocking while loop will not write.
Download the latest release of node and tick the charm bar on each
req.on('data'... makes many trips around the event
loop, charm.write will actually write to the stream it's piped to. In
this case process.stdout.
Same as the HTTP charm bar, but set the foreground color disco style!!
There you go, a simple way to write progress indicators in node.