Typescript ve macOS ile clipboard yonetimi, copy paste
programming, typescript
import { execSync } from 'child_process';
/**
* Copies text to the clipboard.
* @param text The text to be copied to the clipboard.
*/
export function copy(text: string): void {
execSync(`echo "${text.replace(/"/g, '\\"')}" | pbcopy`);
}
/**
* Returns the text from the clipboard.
* @returns The text from the clipboard.
*/
export function paste(): string {
return execSync('pbpaste').toString();
}PreviousTypeScript kullanarak Bun:test ile Hata Fırlatılmasını Beklemek - ts(2348)NextTypescriptle google-spreadsheet ile google sheet duzenlemek
Last updated
Was this helpful?