Clipboard
API Reference
Clipboard.copy
Signature
async function copy(content: string | number | Content, options?: CopyOptions): Promise<void>;Example
import { Clipboard } from "@raycast/api";
export default async function Command() {
// copy some text
await Clipboard.copy("https://raycast.com");
const textContent: Clipboard.Content = {
text: "https://raycast.com",
};
await Clipboard.copy(textContent);
// copy a file
const file = "/path/to/file.pdf";
try {
const fileContent: Clipboard.Content = { file };
await Clipboard.copy(fileContent);
} catch (error) {
console.log(`Could not copy file '${file}'. Reason: ${error}`);
}
// copy confidential data
await Clipboard.copy("my-secret-password", { concealed: true });
}Parameters
Name
Description
Type
Return
Clipboard.paste
Signature
Example
Parameters
Name
Description
Type
Return
Clipboard.clear
Signature
Example
Return
Clipboard.read
Signature
Example
Parameters
Name
Description
Type
Return
Clipboard.readText
Signature
Example
Parameters
Name
Description
Type
Return
Types
Clipboard.Content
Clipboard.ReadContent
Clipboard.CopyOptions
Properties
Property
Description
Type
Last updated

