Last active
May 14, 2016 19:38
-
-
Save toolmantim/48ca212160881f7254b7 to your computer and use it in GitHub Desktop.
Node functions for embedding images in your build output using iTerm or Buildkite
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
function artifactOutput(imagePath) { | |
return '\033]1338;url=artifact://' + imagePath + ';alt=' + imagePath + '\07\n'; | |
} | |
function base64Output(imagePath) { | |
var encodedImage = fs.readFileSync(imagePath, {encoding: 'base64'}); | |
return '\033]1337;File=name=' + imagePath + ';inline=1:' + encodedImage + '\07\n'; | |
} | |
function inlineImage(imagePath) { | |
if (process.env.CI) | |
return artifactOutput(imagePath); | |
else | |
return base64Output(imagePath); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment