Write one or more pasteboard items atomically, replacing all current contents.
Each element of items is an object mapping UTI type strings to either strings or binary
data (Uint8Array, typed array, or ArrayBuffer), matching the shape returned by
readItems(). Use this to restore multi-item clipboard contents (such as multiple copied
files) or arbitrary multi-UTI binary payloads without losing fidelity.
An item whose only key is "public.file-url" is written as a file URL, the same way
writeURLs() writes it. Items with other representations as well are written as raw data.
Either way, sandboxed apps that paste a "public.file-url" can open the file, so a Finder
copy saved with readItems() can be restored with writeItems() and pasted as files.
If any item isn't an object with at least one string or binary value, nothing is written.
Within an item, values that aren't strings or binary data are skipped, with a warning in the Console.
Write one or more pasteboard items atomically, replacing all current contents.
Each element of
itemsis an object mapping UTI type strings to either strings or binary data (Uint8Array, typed array, orArrayBuffer), matching the shape returned byreadItems(). Use this to restore multi-item clipboard contents (such as multiple copied files) or arbitrary multi-UTI binary payloads without losing fidelity.An item whose only key is
"public.file-url"is written as a file URL, the same waywriteURLs()writes it. Items with other representations as well are written as raw data. Either way, sandboxed apps that paste a"public.file-url"can open the file, so a Finder copy saved withreadItems()can be restored withwriteItems()and pasted as files.If any item isn't an object with at least one string or binary value, nothing is written. Within an item, values that aren't strings or binary data are skipped, with a warning in the Console.