@visulima/ansi
Version:
ANSI escape codes for some terminal swag.
29 lines (24 loc) • 956 B
JavaScript
;
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
const node_buffer = require('node:buffer');
const constants = require('./packem_shared/constants-BK26O-46.cjs');
var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
const image = /* @__PURE__ */ __name((data, options = {}) => {
if (!data) {
return "";
}
let returnValue = `${constants.OSC}1337;File=inline=1`;
if (options.width !== void 0) {
returnValue += `;width=${options.width}`;
}
if (options.height !== void 0) {
returnValue += `;height=${options.height}`;
}
if (options.preserveAspectRatio === false) {
returnValue += ";preserveAspectRatio=0";
}
const base64Data = node_buffer.Buffer.from(data).toString("base64");
return `${returnValue}:${base64Data}${constants.BEL}`;
}, "image");
exports.image = image;