New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

term-image

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

term-image

[forked to add options] Display images in the terminal

  • 0.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

terminal-image Build Status

Display images in the terminal

Works in any terminal that supports colors.

In iTerm, the image will be displayed in full resolution, since iTerm has special image support.

Install

$ npm install terminal-image

Usage

const terminalImage = require('terminal-image');

(async () => {
	console.log(await terminalImage.file('unicorn.jpg'));
})();

API

Supports PNG and JPEG images.

terminalImage.buffer(imageBuffer)

Returns a Promise<string> with the ansi escape codes to display the image.

imageBuffer

Type: Buffer

Buffer with the image.

terminalImage.file(filePath)

Returns a Promise<string> with the ansi escape codes to display the image.

filePath

Type: string

File path to the image.

Tip

Display a remote image

const terminalImage = require('terminal-image');
const got = require('got');

(async () => {
	const {body} = await got('sindresorhus.com/unicorn', {encoding: null});
	console.log(await terminalImage.buffer(body));
})();

License

MIT © Sindre Sorhus

Keywords

FAQs

Package last updated on 09 Jul 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc