Skip to content

Instantly share code, notes, and snippets.

@cecilemuller
Created September 24, 2025 15:41
Show Gist options
  • Save cecilemuller/c8cedde21e9591081645842e37fb8f85 to your computer and use it in GitHub Desktop.
Save cecilemuller/c8cedde21e9591081645842e37fb8f85 to your computer and use it in GitHub Desktop.
Node utils (Windows)
import { spawn } from "node:child_process";
// Copies text to the Windows clipboard
export function copyToClipboard(text: string) {
spawn("clip").stdin.end(text);
}
import { exec } from "node:child_process";
// Opens a file in VSCode
export async function openEditor(filepath: string): Promise<void> {
return new Promise(resolve => {
exec(`code ${filepath}`, () => {
resolve();
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment