

progress-img
source link: https://www.npmjs.com/package/progress-img
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

progress-img
Use images as progress bars in the terminal!
Requirements
- Node.js v4.0 or higher
iTerm2 v2.9 or higher is required to display actual images. Otherwise an ASCII version of the images will be displayed.
Installation
Usage
Note: The clear()
function is optional, however the done()
function should always be ran when you are finished with the progress image.
Images
The first parameter of the initial ProgressImg
setup function is where you set the image(s) that you would like to use. If one is not supplied, a default one will be used.
This parameter accepts a string or an array filled with strings that contain either a file path, URL, or image buffer.
Options
These options can be passed as the second parameter to either the initial ProgressImg
setup, or to the progress.set
function.
image
The image(s) to use. Can be used instead of the image
parameter. (Defaults to ./loader.gif
)
Note: This option can only be used in the initial ProgressImg
setup.
width
height
The width and height of the image. Can be one of the following: (Defaults to 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.
Note: This option can only be used in the initial ProgressImg
setup when using the ASCII fallback.
preserveAspectRatio
Whether to preserve the aspect ratio of the image or not. (Defaults to true
)
expandGifs
Whether or not to expand GIFs into separate frames. (Defaults to true
)
Note: This option can only be used in the initial ProgressImg
setup.
useFallback
Whether to use the fallback progress bar regardless if the user is using a supported terminal or not. Great for testing how the fallback progress bar looks or bypassing the terminal check. (Defaults to null
)
Note: This option can only be used in the initial ProgressImg
setup.
textTop
textBottom
Text to display above or below the image. (Defaults to null
)
saveOptions
Whether to overwrite the options set in the initial ProgressImg
setup. (Defaults to false
)
Note: This option can only be used in the progress.set
function.
The frame number or percentage to set the progress to. Can be used instead of set
parameter. Can also be used in the initial ProgressImg
setup. (Defaults to null
)
frameThrottle
Throttle the frame changes by: (Defaults to 0
)
N
: Actual frame count.N%
: Frame count percentage.Nms
: Milliseconds since the last frame change.
Note: 500ms
is recommended for a smoother animation.
output
The stream to output to. (Defaults to process.stdout
)
License
MIT. See the License file for more info.
Recommend
-
31
...
-
64
Up nextAutoplay Related GIFs
-
32
IMG 5633 GIFHi! We use cookies and similar technologies (“cookies”), including third-party cookies, on this website to help operate and improve your experience on our site, monitor our site performance, and for advertising purposes. By...
-
21
Closed Bug 1542784 (lazyload) Opened 2 years ago Closed 10 months a...
-
9
Goosebumps! empty img src error events in FirefoxGoosebumps! empty img src error events in Firefox 07 Sep 2016 It’s almost Septemberween, which means it’s that time of the year we gather ‘round our spinning MacBook fans a...
-
9
Virtualization Install FreeBSD 10.0 using memstick IMG file on Virtualbox ...
-
4
The Humble Element And Core Web Vitals — Smashing MagazineAbout The AuthorAddy Osmani is an engineering manager working on Google Chrome. His team focuses on speed tools and frameworks, helping keep the web fast. Devo...
-
13
Seo Friendly Url css img js not working advertisements I want to make my URL as SEO Friendly URL. I tried editing .htaccess file by rewriting...
-
10
Javascript: Defining img src with an absolute path advertisements I am trying to manually set the img src to a path on the filesystem, and the...
-
4
虚拟机 img 镜像密码修改 September 3, 2021 • Read: 76 •
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK