Node.js bindings to display images in iTerm2 (nightly builds only).
npm install iterm2-imagesh
npm install iterm2-image
`Usage
`js
var drawInIterm = require('iterm2-image');
`Load (and display) an image from a filepath:
`js
drawInIterm('./path-to-file.png', function () {
imgLoader('./path-to-file.png', function (err) {
if (err) { throw err; }
console.log('done!');
});
`Easy, huh? Now using streams:
`js
var http = require('http');var img = 'http://your/image';
http.get(img, function(res) {
if (res.statusCode === 200) {
drawInIterm(res, function () {
if (err) { throw err; }
console.log('done!');
});
}
});
`` * Parametrize output stream.
* Return something meaningful in callback.
Inspired by iTerm2 Site image documentation section and Python Bindings.
Nyan Cat image obtained from here.