hammerspoon2-docs
    Preparing search index...

    Function readItems

    • Read all items currently on the pasteboard with their UTI representations as Uint8Arrays.

      Unlike the single-value readers, this preserves per-item boundaries (for example, multiple files copied in Finder appear as separate objects in the returned array, each carrying its own "public.file-url" payload).

      Reading every representation can be slow and use a lot of memory: apps often provide some formats only on request, so reading them makes the app that copied the data produce each one. Pass options.types to read only the UTIs you need, skipping large or unwanted representations (such as "com.apple.webarchive" or dynamic "dyn.*" types).

      Items with none of the requested types are left out of the returned array. If options is an array, or options.types isn't an array of strings, nothing is read and a warning is logged to the Console; unknown options are ignored with a warning.

      Parameters

      • Optionaloptions: { types?: string[] } | null

        Which representations to read

        • { types?: string[] }
          • Optionaltypes?: string[]

            The UTIs to read. When omitted, every UTI on every item is read.

        • null

      Returns Record<string, Uint8Array<ArrayBufferLike>>[]

      Array of item objects mapping UTI strings to raw bytes