Created
July 11, 2023 09:43
-
-
Save beshur/41a15c0272454373fd07ba9fbc6dfd5d to your computer and use it in GitHub Desktop.
Encode to base64 And Open prisma.schema in prismalizer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
const { readFileSync } = require("fs"); | |
const cp = require("child_process"); | |
function openUrl(port) { | |
const data = btoa(readFileSync("./prisma/schema.prisma", "utf8")); | |
console.log("data.length", data.length); | |
const start = | |
process.platform == "darwin" | |
? "open" | |
: process.platform == "win32" | |
? "start" | |
: "xdg-open"; | |
cp.exec(`${start} http://localhost:${port}/?code=${data}`); | |
console.log("open", start); | |
} | |
const args = new Set(process.argv.slice(2)); | |
let port = 3000; | |
for (const entry of args) { | |
port = entry; | |
} | |
openUrl(port); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment