Created
September 24, 2025 15:41
-
-
Save cecilemuller/c8cedde21e9591081645842e37fb8f85 to your computer and use it in GitHub Desktop.
Node utils (Windows)
This file contains hidden or 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
import { spawn } from "node:child_process"; | |
// Copies text to the Windows clipboard | |
export function copyToClipboard(text: string) { | |
spawn("clip").stdin.end(text); | |
} |
This file contains hidden or 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
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