Learn to Code via Tutorials on Repl.it!

← Back to all posts
How to print images in the console! (JavaScript)
zplusfour

Hi!

Welcome to another tutoiral! today we're gonna print images in Repl console!

Make sure you:

  • have a repl

that's it, stick with me onto this!

First, installing dependencies

Go to the packages button, and search for console-png or you can just open the terminal and type npm i console-png

Second, writing code

Now, we need to write our image printer! We'll have these few lines of code:

So in the first line, we attach the .png method to the Console namespace, to use it as console.png.
In the second line, we store the buffer into a global variable, MAKE SURE YOU HAVE fs.
In the last line, we'll print the image as a string!!!


I hope you enjoyed this tiny tutorial, if you get stuck, fork the repl or run it.
Have a great day!!

Voters
Aivoybia
LuckyOreos
EpicGamer007
programmeruser
Sleek
zplusfour