svg-to-url
Version:
A simple tool to convert svg file to data url
27 lines (23 loc) • 574 B
JavaScript
import { Command } from "commander";
import chalk from "chalk";
import clipboardy from "clipboardy";
import svgToUrl from "./index.js";
const program = new Command();
program
.arguments("<file>")
.action((filePath) => {
svgToUrl(filePath)
.then((data) => {
console.log(data);
return data;
})
.then(clipboardy.write)
.then(() => {
console.log(chalk.green("Copied to clipboard!"));
})
.catch((error) => {
console.error(chalk.red(error));
});
})
.parse(process.argv);