UNPKG

pixgo

Version:

A CLI tool to upload images to Cloudinary

22 lines (19 loc) 447 B
import yoctoSpinner from 'yocto-spinner'; export const createSpinner = (text, color = 'yellow') => { return new yoctoSpinner({ text, color, }); }; export const withSpinner = async (text, asyncFn, color = 'yellow') => { const spinner = createSpinner(text, color); spinner.start(); try { const result = await asyncFn(); spinner.stop(); return result; } catch (error) { spinner.stop(); throw error; } };