8000 GitHub - jefftougas/term-img: Display images in your terminal
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

jefftougas/term-img

 
 

Repository files navigation

term-img Build Status

Display images in your terminal

Even animated gifs!

Currently only supported on iTerm >=3.

Install

$ npm install --save term-img

Usage

const termImg = require('term-img');

function fallback() {
	// Do something else when not supported
}

termImg('unicorn.jpg', {fallback});

API

termImg(input, [options])

input

Type: string Buffer

Filepath to an image or an image as a buffer.

options

width
height

Type: string number

The width and height are given as a number followed by a unit, or the word 'auto'.

  • N: N character cells.
  • Npx: N pixels.
  • N%: N percent of the session's width or height.
  • auto: The image's inherent size will be used to determine an appropriate dimension.
preserveAspectRatio

Type: boolean
Default: true

fallback

Type: Function
Default: () => throw new UnsupportedTerminal()

Enables you to do something else when the terminal doesn't support images.

Related

License

MIT © Sindre Sorhus

About

Display images in your terminal

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%
0