mdfind-node
Version:
Node.js bindings for macOS Spotlight search (mdfind, mdls, mdutil)
2,193 lines • 78.9 kB
TypeScript
import { z } from 'zod';
import { ChildProcess } from 'node:child_process';
/**
* Schema for Spotlight content types (UTIs).
* Validates common Uniform Type Identifiers (UTIs) used by macOS Spotlight.
* Also accepts custom UTIs as strings.
*
* Common types include:
* - public.audio: Audio files (MP3, WAV, etc.)
* - public.image: Image files (JPEG, PNG, etc.)
* - public.movie: Video files (MP4, MOV, etc.)
* - public.pdf: PDF documents
* - public.plain-text: Plain text files
* - public.rtf: Rich Text Format documents
* - public.html: HTML documents
* - public.font: Font files
*
* @example
* ```typescript
* // Using predefined types
* const imageType = SpotlightContentTypeSchema.parse('public.image')
* const audioType = SpotlightContentTypeSchema.parse('public.audio')
*
* // Using custom UTI
* const customType = SpotlightContentTypeSchema.parse('com.adobe.photoshop')
* ```
*/
declare const SpotlightContentTypeSchema: z.ZodUnion<[z.ZodEnum<["public.audio", "public.image", "public.movie", "public.pdf", "public.plain-text", "public.rtf", "public.html", "public.font"]>, z.ZodString]>;
/**
* Schema for Spotlight metadata attributes.
* Validates common metadata attribute names used in Spotlight queries.
* Also accepts custom attribute names as strings.
*
* Attributes are grouped into categories:
*
* General attributes:
* - kMDItemDisplayName: Display name of the file
* - kMDItemFSName: Filesystem name
* - kMDItemPath: Full path to the file
* - kMDItemContentType: UTI content type
* - kMDItemContentTypeTree: Hierarchy of content types
* - kMDItemKind: Localized file type description
* - kMDItemLastUsedDate: Last access date
* - kMDItemContentCreationDate: Creation date
* - kMDItemContentModificationDate: Modification date
*
* Document attributes:
* - kMDItemTitle: Document title
* - kMDItemAuthors: Author names
* - kMDItemComment: User comments
* - kMDItemCopyright: Copyright information
* - kMDItemKeywords: Keywords/tags
* - kMDItemNumberOfPages: Page count
* - kMDItemLanguages: Document languages
*
* Media attributes:
* - kMDItemDurationSeconds: Media duration
* - kMDItemCodecs: Media codecs used
* - kMDItemPixelHeight: Image height
* - kMDItemPixelWidth: Image width
* - kMDItemAudioBitRate: Audio bit rate
* - kMDItemAudioChannelCount: Audio channels
* - kMDItemTotalBitRate: Total media bit rate
*
* Image specific:
* - kMDItemOrientation: Image orientation
* - kMDItemFlashOnOff: Flash status
* - kMDItemFocalLength: Lens focal length
* - kMDItemAcquisitionMake: Camera manufacturer
* - kMDItemAcquisitionModel: Camera model
* - kMDItemISOSpeed: ISO speed rating
* - kMDItemExposureTimeSeconds: Exposure time
*
* Location attributes:
* - kMDItemLatitude: GPS latitude
* - kMDItemLongitude: GPS longitude
* - kMDItemAltitude: GPS altitude
* - kMDItemCity: City name
* - kMDItemStateOrProvince: State/province
* - kMDItemCountry: Country name
*
* @example
* Basic attribute usage:
* ```typescript
* const attr = SpotlightAttributeSchema.parse('kMDItemDisplayName')
* ```
*
* @example
* Custom attribute:
* ```typescript
* const customAttr = SpotlightAttributeSchema.parse('kMDItem_CustomAttribute')
* ```
*/
declare const SpotlightAttributeSchema: z.ZodUnion<[z.ZodEnum<["kMDItemDisplayName", "kMDItemFSName", "kMDItemPath", "kMDItemContentType", "kMDItemContentTypeTree", "kMDItemKind", "kMDItemLastUsedDate", "kMDItemContentCreationDate", "kMDItemContentModificationDate", "kMDItemTitle", "kMDItemAuthors", "kMDItemComment", "kMDItemCopyright", "kMDItemKeywords", "kMDItemNumberOfPages", "kMDItemLanguages", "kMDItemDurationSeconds", "kMDItemCodecs", "kMDItemPixelHeight", "kMDItemPixelWidth", "kMDItemAudioBitRate", "kMDItemAudioChannelCount", "kMDItemTotalBitRate", "kMDItemOrientation", "kMDItemFlashOnOff", "kMDItemFocalLength", "kMDItemAcquisitionMake", "kMDItemAcquisitionModel", "kMDItemISOSpeed", "kMDItemExposureTimeSeconds", "kMDItemLatitude", "kMDItemLongitude", "kMDItemAltitude", "kMDItemCity", "kMDItemStateOrProvince", "kMDItemCountry"]>, z.ZodString]>;
declare const MetadataResultSchema: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodDate, z.ZodArray<z.ZodString, "many">, z.ZodNull]>>;
type SpotlightContentType = z.infer<typeof SpotlightContentTypeSchema>;
type SpotlightAttribute = z.infer<typeof SpotlightAttributeSchema>;
type MetadataResult = z.infer<typeof MetadataResultSchema>;
/**
* Schema for live search event handlers.
* Validates the callback functions used in real-time file monitoring.
*
* Event handlers:
* - onResult: Called when files are found or updated
* - Receives array of file paths
* - Called immediately with initial results
* - Called again when files change
*
* - onError: Called when search encounters an error
* - Receives MdfindError object
* - Search may continue after some errors
*
* - onEnd: Optional callback when search ends
* - Called when search is stopped
* - No arguments provided
*
* @example
* Basic usage:
* ```typescript
* const events = LiveSearchEventsSchema.parse({
* onResult: (paths) => {
* console.log('Found files:', paths)
* },
* onError: (error) => {
* console.error('Search failed:', error.message)
* },
* onEnd: () => {
* console.log('Search ended')
* }
* })
* ```
*
* @example
* Minimal handlers:
* ```typescript
* const events = LiveSearchEventsSchema.parse({
* onResult: (paths) => {
* console.log('Files:', paths)
* },
* onError: (error) => {
* console.error(error)
* }
* })
* ```
*/
declare const LiveSearchEventsSchema: z.ZodObject<{
onResult: z.ZodFunction<z.ZodTuple<[z.ZodArray<z.ZodString, "many">], z.ZodUnknown>, z.ZodVoid>;
onError: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
name: z.ZodLiteral<"MdfindError">;
message: z.ZodString;
stderr: z.ZodString;
}, "strict", z.ZodTypeAny, {
message: string;
name: "MdfindError";
stderr: string;
}, {
message: string;
name: "MdfindError";
stderr: string;
}>], z.ZodUnknown>, z.ZodVoid>;
onEnd: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodVoid>>;
}, "strict", z.ZodTypeAny, {
onResult: (args_0: string[], ...args: unknown[]) => void;
onError: (args_0: {
message: string;
name: "MdfindError";
stderr: string;
}, ...args: unknown[]) => void;
onEnd?: ((...args: unknown[]) => void) | undefined;
}, {
onResult: (args_0: string[], ...args: unknown[]) => void;
onError: (args_0: {
message: string;
name: "MdfindError";
stderr: string;
}, ...args: unknown[]) => void;
onEnd?: ((...args: unknown[]) => void) | undefined;
}>;
type LiveSearchEvents = z.infer<typeof LiveSearchEventsSchema>;
/**
* Represents the status of Spotlight indexing for a volume
*/
declare const IndexStatusSchema: z.ZodObject<{
/**
* The current state of indexing
*/
state: z.ZodEnum<["enabled", "disabled", "unknown", "error"]>;
/**
* Whether indexing is enabled (maintained for backward compatibility)
*/
enabled: z.ZodBoolean;
/**
* The raw status message from mdutil
*/
status: z.ZodString;
/**
* The last time the volume was scanned
*/
scanBaseTime: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
/**
* The reason for the current state
*/
reasoning: z.ZodOptional<z.ZodNullable<z.ZodString>>;
/**
* The volume path that was checked
*/
volumePath: z.ZodString;
/**
* Whether this volume is a system volume
*/
isSystemVolume: z.ZodBoolean;
}, "strict", z.ZodTypeAny, {
status: string;
enabled: boolean;
state: "unknown" | "enabled" | "disabled" | "error";
volumePath: string;
isSystemVolume: boolean;
scanBaseTime?: Date | null | undefined;
reasoning?: string | null | undefined;
}, {
status: string;
enabled: boolean;
state: "unknown" | "enabled" | "disabled" | "error";
volumePath: string;
isSystemVolume: boolean;
scanBaseTime?: Date | null | undefined;
reasoning?: string | null | undefined;
}>;
type IndexStatus = z.infer<typeof IndexStatusSchema>;
/**
* Schema for basic file metadata.
* Provides essential file information commonly used in file operations.
*
* Properties:
* - name: Display name or filename
* - contentType: UTI content type (e.g., 'public.image')
* - kind: Localized file type description
* - size: File size in bytes (0 if unavailable)
* - created: Creation timestamp (null if unavailable)
* - modified: Last modification timestamp (null if unavailable)
* - lastOpened: Last access timestamp (null if unavailable)
*/
declare const BasicMetadataSchema: z.ZodObject<{
name: z.ZodString;
contentType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
kind: z.ZodOptional<z.ZodNullable<z.ZodString>>;
size: z.ZodOptional<z.ZodNumber>;
created: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodDate, z.ZodEffects<z.ZodString, Date, string>, z.ZodEffects<z.ZodNumber, Date, number>, z.ZodEffects<z.ZodArray<z.ZodUnion<[z.ZodDate, z.ZodString, z.ZodNumber]>, "many">, Date | undefined, (string | number | Date)[]>]>>>, Date | null, string | number | Date | (string | number | Date)[] | null | undefined>;
modified: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodDate, z.ZodEffects<z.ZodString, Date, string>, z.ZodEffects<z.ZodNumber, Date, number>, z.ZodEffects<z.ZodArray<z.ZodUnion<[z.ZodDate, z.ZodString, z.ZodNumber]>, "many">, Date | undefined, (string | number | Date)[]>]>>>, Date | null, string | number | Date | (string | number | Date)[] | null | undefined>;
lastOpened: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodDate, z.ZodEffects<z.ZodString, Date, string>, z.ZodEffects<z.ZodNumber, Date, number>, z.ZodEffects<z.ZodArray<z.ZodUnion<[z.ZodDate, z.ZodString, z.ZodNumber]>, "many">, Date | undefined, (string | number | Date)[]>]>>>, Date | null, string | number | Date | (string | number | Date)[] | null | undefined>;
}, "strip", z.ZodTypeAny, {
name: string;
created: Date | null;
modified: Date | null;
lastOpened: Date | null;
contentType?: string | null | undefined;
kind?: string | null | undefined;
size?: number | undefined;
}, {
name: string;
contentType?: string | null | undefined;
kind?: string | null | undefined;
size?: number | undefined;
created?: string | number | Date | (string | number | Date)[] | null | undefined;
modified?: string | number | Date | (string | number | Date)[] | null | undefined;
lastOpened?: string | number | Date | (string | number | Date)[] | null | undefined;
}>;
type BasicMetadata = z.infer<typeof BasicMetadataSchema>;
/**
* Schema for EXIF (Exchangeable Image File Format) metadata.
* Validates and transforms EXIF data commonly found in image files.
*/
declare const ExifDataSchema: z.ZodObject<{
make: z.ZodOptional<z.ZodNullable<z.ZodString>>;
model: z.ZodOptional<z.ZodNullable<z.ZodString>>;
lens: z.ZodOptional<z.ZodNullable<z.ZodString>>;
exposureTime: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
fNumber: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
isoSpeedRatings: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
focalLength: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
gpsLatitude: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
gpsLongitude: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
gpsAltitude: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
dateTimeOriginal: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodDate, z.ZodEffects<z.ZodString, Date, string>, z.ZodEffects<z.ZodNumber, Date, number>, z.ZodEffects<z.ZodArray<z.ZodUnion<[z.ZodDate, z.ZodString, z.ZodNumber]>, "many">, Date | undefined, (string | number | Date)[]>]>>>, Date | null, string | number | Date | (string | number | Date)[] | null | undefined>;
dateTimeDigitized: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodDate, z.ZodEffects<z.ZodString, Date, string>, z.ZodEffects<z.ZodNumber, Date, number>, z.ZodEffects<z.ZodArray<z.ZodUnion<[z.ZodDate, z.ZodString, z.ZodNumber]>, "many">, Date | undefined, (string | number | Date)[]>]>>>, Date | null, string | number | Date | (string | number | Date)[] | null | undefined>;
}, "strip", z.ZodTypeAny, {
dateTimeOriginal: Date | null;
dateTimeDigitized: Date | null;
make?: string | null | undefined;
model?: string | null | undefined;
lens?: string | null | undefined;
exposureTime?: number | null | undefined;
fNumber?: number | null | undefined;
isoSpeedRatings?: number | null | undefined;
focalLength?: number | null | undefined;
gpsLatitude?: number | null | undefined;
gpsLongitude?: number | null | undefined;
gpsAltitude?: number | null | undefined;
}, {
make?: string | null | undefined;
model?: string | null | undefined;
lens?: string | null | undefined;
exposureTime?: number | null | undefined;
fNumber?: number | null | undefined;
isoSpeedRatings?: number | null | undefined;
focalLength?: number | null | undefined;
gpsLatitude?: number | null | undefined;
gpsLongitude?: number | null | undefined;
gpsAltitude?: number | null | undefined;
dateTimeOriginal?: string | number | Date | (string | number | Date)[] | null | undefined;
dateTimeDigitized?: string | number | Date | (string | number | Date)[] | null | undefined;
}>;
type ExifData = z.infer<typeof ExifDataSchema>;
/**
* Schema for XMP (Extensible Metadata Platform) metadata.
* Validates and transforms XMP data commonly found in media files.
*/
declare const XMPDataSchema: z.ZodObject<{
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
creator: z.ZodOptional<z.ZodNullable<z.ZodString>>;
subject: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
createDate: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodDate, z.ZodEffects<z.ZodString, Date, string>, z.ZodEffects<z.ZodNumber, Date, number>, z.ZodEffects<z.ZodArray<z.ZodUnion<[z.ZodDate, z.ZodString, z.ZodNumber]>, "many">, Date | undefined, (string | number | Date)[]>]>>>, Date | null, string | number | Date | (string | number | Date)[] | null | undefined>;
modifyDate: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodDate, z.ZodEffects<z.ZodString, Date, string>, z.ZodEffects<z.ZodNumber, Date, number>, z.ZodEffects<z.ZodArray<z.ZodUnion<[z.ZodDate, z.ZodString, z.ZodNumber]>, "many">, Date | undefined, (string | number | Date)[]>]>>>, Date | null, string | number | Date | (string | number | Date)[] | null | undefined>;
metadataDate: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodDate, z.ZodEffects<z.ZodString, Date, string>, z.ZodEffects<z.ZodNumber, Date, number>, z.ZodEffects<z.ZodArray<z.ZodUnion<[z.ZodDate, z.ZodString, z.ZodNumber]>, "many">, Date | undefined, (string | number | Date)[]>]>>>, Date | null, string | number | Date | (string | number | Date)[] | null | undefined>;
copyrightNotice: z.ZodOptional<z.ZodNullable<z.ZodString>>;
rights: z.ZodOptional<z.ZodNullable<z.ZodString>>;
webStatement: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}, "strip", z.ZodTypeAny, {
createDate: Date | null;
modifyDate: Date | null;
metadataDate: Date | null;
title?: string | null | undefined;
description?: string | null | undefined;
creator?: string | null | undefined;
subject?: string[] | null | undefined;
copyrightNotice?: string | null | undefined;
rights?: string | null | undefined;
webStatement?: string | null | undefined;
}, {
title?: string | null | undefined;
description?: string | null | undefined;
creator?: string | null | undefined;
subject?: string[] | null | undefined;
createDate?: string | number | Date | (string | number | Date)[] | null | undefined;
modifyDate?: string | number | Date | (string | number | Date)[] | null | undefined;
metadataDate?: string | number | Date | (string | number | Date)[] | null | undefined;
copyrightNotice?: string | null | undefined;
rights?: string | null | undefined;
webStatement?: string | null | undefined;
}>;
type XMPData = z.infer<typeof XMPDataSchema>;
declare const ExtendedMetadataSchema: z.ZodObject<{
basic: z.ZodObject<{
name: z.ZodString;
contentType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
kind: z.ZodOptional<z.ZodNullable<z.ZodString>>;
size: z.ZodOptional<z.ZodNumber>;
created: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodDate, z.ZodEffects<z.ZodString, Date, string>, z.ZodEffects<z.ZodNumber, Date, number>, z.ZodEffects<z.ZodArray<z.ZodUnion<[z.ZodDate, z.ZodString, z.ZodNumber]>, "many">, Date | undefined, (string | number | Date)[]>]>>>, Date | null, string | number | Date | (string | number | Date)[] | null | undefined>;
modified: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodDate, z.ZodEffects<z.ZodString, Date, string>, z.ZodEffects<z.ZodNumber, Date, number>, z.ZodEffects<z.ZodArray<z.ZodUnion<[z.ZodDate, z.ZodString, z.ZodNumber]>, "many">, Date | undefined, (string | number | Date)[]>]>>>, Date | null, string | number | Date | (string | number | Date)[] | null | undefined>;
lastOpened: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodDate, z.ZodEffects<z.ZodString, Date, string>, z.ZodEffects<z.ZodNumber, Date, number>, z.ZodEffects<z.ZodArray<z.ZodUnion<[z.ZodDate, z.ZodString, z.ZodNumber]>, "many">, Date | undefined, (string | number | Date)[]>]>>>, Date | null, string | number | Date | (string | number | Date)[] | null | undefined>;
}, "strip", z.ZodTypeAny, {
name: string;
created: Date | null;
modified: Date | null;
lastOpened: Date | null;
contentType?: string | null | undefined;
kind?: string | null | undefined;
size?: number | undefined;
}, {
name: string;
contentType?: string | null | undefined;
kind?: string | null | undefined;
size?: number | undefined;
created?: string | number | Date | (string | number | Date)[] | null | undefined;
modified?: string | number | Date | (string | number | Date)[] | null | undefined;
lastOpened?: string | number | Date | (string | number | Date)[] | null | undefined;
}>;
exif: z.ZodOptional<z.ZodObject<{
make: z.ZodOptional<z.ZodNullable<z.ZodString>>;
model: z.ZodOptional<z.ZodNullable<z.ZodString>>;
lens: z.ZodOptional<z.ZodNullable<z.ZodString>>;
exposureTime: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
fNumber: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
isoSpeedRatings: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
focalLength: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
gpsLatitude: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
gpsLongitude: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
gpsAltitude: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
dateTimeOriginal: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodDate, z.ZodEffects<z.ZodString, Date, string>, z.ZodEffects<z.ZodNumber, Date, number>, z.ZodEffects<z.ZodArray<z.ZodUnion<[z.ZodDate, z.ZodString, z.ZodNumber]>, "many">, Date | undefined, (string | number | Date)[]>]>>>, Date | null, string | number | Date | (string | number | Date)[] | null | undefined>;
dateTimeDigitized: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodDate, z.ZodEffects<z.ZodString, Date, string>, z.ZodEffects<z.ZodNumber, Date, number>, z.ZodEffects<z.ZodArray<z.ZodUnion<[z.ZodDate, z.ZodString, z.ZodNumber]>, "many">, Date | undefined, (string | number | Date)[]>]>>>, Date | null, string | number | Date | (string | number | Date)[] | null | undefined>;
}, "strip", z.ZodTypeAny, {
dateTimeOriginal: Date | null;
dateTimeDigitized: Date | null;
make?: string | null | undefined;
model?: string | null | undefined;
lens?: string | null | undefined;
exposureTime?: number | null | undefined;
fNumber?: number | null | undefined;
isoSpeedRatings?: number | null | undefined;
focalLength?: number | null | undefined;
gpsLatitude?: number | null | undefined;
gpsLongitude?: number | null | undefined;
gpsAltitude?: number | null | undefined;
}, {
make?: string | null | undefined;
model?: string | null | undefined;
lens?: string | null | undefined;
exposureTime?: number | null | undefined;
fNumber?: number | null | undefined;
isoSpeedRatings?: number | null | undefined;
focalLength?: number | null | undefined;
gpsLatitude?: number | null | undefined;
gpsLongitude?: number | null | undefined;
gpsAltitude?: number | null | undefined;
dateTimeOriginal?: string | number | Date | (string | number | Date)[] | null | undefined;
dateTimeDigitized?: string | number | Date | (string | number | Date)[] | null | undefined;
}>>;
xmp: z.ZodOptional<z.ZodObject<{
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
creator: z.ZodOptional<z.ZodNullable<z.ZodString>>;
subject: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
createDate: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodDate, z.ZodEffects<z.ZodString, Date, string>, z.ZodEffects<z.ZodNumber, Date, number>, z.ZodEffects<z.ZodArray<z.ZodUnion<[z.ZodDate, z.ZodString, z.ZodNumber]>, "many">, Date | undefined, (string | number | Date)[]>]>>>, Date | null, string | number | Date | (string | number | Date)[] | null | undefined>;
modifyDate: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodDate, z.ZodEffects<z.ZodString, Date, string>, z.ZodEffects<z.ZodNumber, Date, number>, z.ZodEffects<z.ZodArray<z.ZodUnion<[z.ZodDate, z.ZodString, z.ZodNumber]>, "many">, Date | undefined, (string | number | Date)[]>]>>>, Date | null, string | number | Date | (string | number | Date)[] | null | undefined>;
metadataDate: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodDate, z.ZodEffects<z.ZodString, Date, string>, z.ZodEffects<z.ZodNumber, Date, number>, z.ZodEffects<z.ZodArray<z.ZodUnion<[z.ZodDate, z.ZodString, z.ZodNumber]>, "many">, Date | undefined, (string | number | Date)[]>]>>>, Date | null, string | number | Date | (string | number | Date)[] | null | undefined>;
copyrightNotice: z.ZodOptional<z.ZodNullable<z.ZodString>>;
rights: z.ZodOptional<z.ZodNullable<z.ZodString>>;
webStatement: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}, "strip", z.ZodTypeAny, {
createDate: Date | null;
modifyDate: Date | null;
metadataDate: Date | null;
title?: string | null | undefined;
description?: string | null | undefined;
creator?: string | null | undefined;
subject?: string[] | null | undefined;
copyrightNotice?: string | null | undefined;
rights?: string | null | undefined;
webStatement?: string | null | undefined;
}, {
title?: string | null | undefined;
description?: string | null | undefined;
creator?: string | null | undefined;
subject?: string[] | null | undefined;
createDate?: string | number | Date | (string | number | Date)[] | null | undefined;
modifyDate?: string | number | Date | (string | number | Date)[] | null | undefined;
metadataDate?: string | number | Date | (string | number | Date)[] | null | undefined;
copyrightNotice?: string | null | undefined;
rights?: string | null | undefined;
webStatement?: string | null | undefined;
}>>;
spotlight: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodDate, z.ZodArray<z.ZodString, "many">, z.ZodNull]>>;
}, "strip", z.ZodTypeAny, {
basic: {
name: string;
created: Date | null;
modified: Date | null;
lastOpened: Date | null;
contentType?: string | null | undefined;
kind?: string | null | undefined;
size?: number | undefined;
};
spotlight: Record<string, string | number | boolean | Date | string[] | null>;
exif?: {
dateTimeOriginal: Date | null;
dateTimeDigitized: Date | null;
make?: string | null | undefined;
model?: string | null | undefined;
lens?: string | null | undefined;
exposureTime?: number | null | undefined;
fNumber?: number | null | undefined;
isoSpeedRatings?: number | null | undefined;
focalLength?: number | null | undefined;
gpsLatitude?: number | null | undefined;
gpsLongitude?: number | null | undefined;
gpsAltitude?: number | null | undefined;
} | undefined;
xmp?: {
createDate: Date | null;
modifyDate: Date | null;
metadataDate: Date | null;
title?: string | null | undefined;
description?: string | null | undefined;
creator?: string | null | undefined;
subject?: string[] | null | undefined;
copyrightNotice?: string | null | undefined;
rights?: string | null | undefined;
webStatement?: string | null | undefined;
} | undefined;
}, {
basic: {
name: string;
contentType?: string | null | undefined;
kind?: string | null | undefined;
size?: number | undefined;
created?: string | number | Date | (string | number | Date)[] | null | undefined;
modified?: string | number | Date | (string | number | Date)[] | null | undefined;
lastOpened?: string | number | Date | (string | number | Date)[] | null | undefined;
};
spotlight: Record<string, string | number | boolean | Date | string[] | null>;
exif?: {
make?: string | null | undefined;
model?: string | null | undefined;
lens?: string | null | undefined;
exposureTime?: number | null | undefined;
fNumber?: number | null | undefined;
isoSpeedRatings?: number | null | undefined;
focalLength?: number | null | undefined;
gpsLatitude?: number | null | undefined;
gpsLongitude?: number | null | undefined;
gpsAltitude?: number | null | undefined;
dateTimeOriginal?: string | number | Date | (string | number | Date)[] | null | undefined;
dateTimeDigitized?: string | number | Date | (string | number | Date)[] | null | undefined;
} | undefined;
xmp?: {
title?: string | null | undefined;
description?: string | null | undefined;
creator?: string | null | undefined;
subject?: string[] | null | undefined;
createDate?: string | number | Date | (string | number | Date)[] | null | undefined;
modifyDate?: string | number | Date | (string | number | Date)[] | null | undefined;
metadataDate?: string | number | Date | (string | number | Date)[] | null | undefined;
copyrightNotice?: string | null | undefined;
rights?: string | null | undefined;
webStatement?: string | null | undefined;
} | undefined;
}>;
type ExtendedMetadata = z.infer<typeof ExtendedMetadataSchema>;
/**
* Input schema that accepts partial options
*/
declare const MdfindOptionsInputSchema: z.ZodObject<{
live: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
timeout: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
operator: z.ZodOptional<z.ZodDefault<z.ZodEnum<["&&", "||"]>>>;
count: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
reprint: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
nullSeparator: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
maxBuffer: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
literal: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
interpret: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
name: z.ZodOptional<z.ZodOptional<z.ZodString>>;
names: z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>>;
onlyIn: z.ZodOptional<z.ZodOptional<z.ZodString>>;
onlyInDirectory: z.ZodOptional<z.ZodOptional<z.ZodString>>;
attr: z.ZodOptional<z.ZodOptional<z.ZodString>>;
attributes: z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>>;
smartFolder: z.ZodOptional<z.ZodOptional<z.ZodString>>;
}, "strip", z.ZodTypeAny, {
name?: string | undefined;
maxBuffer?: number | undefined;
literal?: boolean | undefined;
interpret?: boolean | undefined;
live?: boolean | undefined;
timeout?: number | undefined;
operator?: "&&" | "||" | undefined;
count?: boolean | undefined;
reprint?: boolean | undefined;
nullSeparator?: boolean | undefined;
names?: string[] | undefined;
onlyIn?: string | undefined;
onlyInDirectory?: string | undefined;
attr?: string | undefined;
attributes?: string[] | undefined;
smartFolder?: string | undefined;
}, {
name?: string | undefined;
maxBuffer?: number | undefined;
literal?: boolean | undefined;
interpret?: boolean | undefined;
live?: boolean | undefined;
timeout?: number | undefined;
operator?: "&&" | "||" | undefined;
count?: boolean | undefined;
reprint?: boolean | undefined;
nullSeparator?: boolean | undefined;
names?: string[] | undefined;
onlyIn?: string | undefined;
onlyInDirectory?: string | undefined;
attr?: string | undefined;
attributes?: string[] | undefined;
smartFolder?: string | undefined;
}>;
/**
* Options for mdls (metadata listing) operations
*/
declare const MdlsOptionsSchema: z.ZodObject<z.objectUtil.extendShape<{
maxBuffer: z.ZodDefault<z.ZodNumber>;
literal: z.ZodDefault<z.ZodBoolean>;
interpret: z.ZodDefault<z.ZodBoolean>;
}, {
attributes: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
raw: z.ZodDefault<z.ZodBoolean>;
nullMarker: z.ZodDefault<z.ZodString>;
structured: z.ZodDefault<z.ZodBoolean>;
}>, "strip", z.ZodTypeAny, {
maxBuffer: number;
literal: boolean;
interpret: boolean;
attributes: string[];
raw: boolean;
nullMarker: string;
structured: boolean;
}, {
maxBuffer?: number | undefined;
literal?: boolean | undefined;
interpret?: boolean | undefined;
attributes?: string[] | undefined;
raw?: boolean | undefined;
nullMarker?: string | undefined;
structured?: boolean | undefined;
}>;
/**
* Options for mdutil (indexing utility) operations
*/
declare const MdutilOptionsSchema: z.ZodObject<z.objectUtil.extendShape<{
maxBuffer: z.ZodDefault<z.ZodNumber>;
literal: z.ZodDefault<z.ZodBoolean>;
interpret: z.ZodDefault<z.ZodBoolean>;
}, {
volume: z.ZodOptional<z.ZodString>;
verbose: z.ZodDefault<z.ZodBoolean>;
excludeSystemVolumes: z.ZodDefault<z.ZodBoolean>;
excludeUnknownState: z.ZodDefault<z.ZodBoolean>;
}>, "strip", z.ZodTypeAny, {
maxBuffer: number;
literal: boolean;
interpret: boolean;
verbose: boolean;
excludeSystemVolumes: boolean;
excludeUnknownState: boolean;
volume?: string | undefined;
}, {
maxBuffer?: number | undefined;
literal?: boolean | undefined;
interpret?: boolean | undefined;
volume?: string | undefined;
verbose?: boolean | undefined;
excludeSystemVolumes?: boolean | undefined;
excludeUnknownState?: boolean | undefined;
}>;
/**
* Options for mdimport (metadata import) operations
*/
declare const MdimportOptionsSchema$1: z.ZodObject<z.objectUtil.extendShape<{
maxBuffer: z.ZodDefault<z.ZodNumber>;
literal: z.ZodDefault<z.ZodBoolean>;
interpret: z.ZodDefault<z.ZodBoolean>;
}, {
recursive: z.ZodDefault<z.ZodBoolean>;
remove: z.ZodDefault<z.ZodBoolean>;
update: z.ZodDefault<z.ZodBoolean>;
scanNow: z.ZodDefault<z.ZodBoolean>;
importerInfo: z.ZodDefault<z.ZodBoolean>;
attributeInfo: z.ZodDefault<z.ZodBoolean>;
}>, "strip", z.ZodTypeAny, {
maxBuffer: number;
literal: boolean;
interpret: boolean;
recursive: boolean;
remove: boolean;
update: boolean;
scanNow: boolean;
importerInfo: boolean;
attributeInfo: boolean;
}, {
maxBuffer?: number | undefined;
literal?: boolean | undefined;
interpret?: boolean | undefined;
recursive?: boolean | undefined;
remove?: boolean | undefined;
update?: boolean | undefined;
scanNow?: boolean | undefined;
importerInfo?: boolean | undefined;
attributeInfo?: boolean | undefined;
}>;
type MdfindOptionsInput = z.input<typeof MdfindOptionsInputSchema>;
type MdlsOptions = z.infer<typeof MdlsOptionsSchema>;
type MdutilOptions = z.infer<typeof MdutilOptionsSchema>;
type MdimportOptions$1 = z.infer<typeof MdimportOptionsSchema$1>;
/**
* Schema for mdimport results
*/
declare const MdimportResultSchema: z.ZodObject<{
/**
* Raw output from mdimport command
*/
output: z.ZodString;
/**
* Performance metrics (only available with showPerformance option)
*/
performance: z.ZodOptional<z.ZodObject<{
totalTime: z.ZodNumber;
importTime: z.ZodNumber;
fileCount: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
totalTime: number;
importTime: number;
fileCount: number;
}, {
totalTime: number;
importTime: number;
fileCount: number;
}>>;
/**
* Debug information (only available with debugLevel option)
*/
debug: z.ZodOptional<z.ZodObject<{
level: z.ZodEnum<["1", "2", "3"]>;
summary: z.ZodString;
attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
}, "strip", z.ZodTypeAny, {
level: "1" | "2" | "3";
summary: string;
attributes?: Record<string, unknown> | undefined;
}, {
level: "1" | "2" | "3";
summary: string;
attributes?: Record<string, unknown> | undefined;
}>>;
}, "strip", z.ZodTypeAny, {
output: string;
performance?: {
totalTime: number;
importTime: number;
fileCount: number;
} | undefined;
debug?: {
level: "1" | "2" | "3";
summary: string;
attributes?: Record<string, unknown> | undefined;
} | undefined;
}, {
output: string;
performance?: {
totalTime: number;
importTime: number;
fileCount: number;
} | undefined;
debug?: {
level: "1" | "2" | "3";
summary: string;
attributes?: Record<string, unknown> | undefined;
} | undefined;
}>;
type MdimportResult = z.infer<typeof MdimportResultSchema>;
/**
* Schema for Spotlight importer information
*/
declare const ImporterInfoSchema: z.ZodObject<{
/**
* Path to the importer bundle
*/
path: z.ZodString;
/**
* Name of the importer
*/
name: z.ZodString;
/**
* Version of the importer
*/
version: z.ZodOptional<z.ZodString>;
/**
* UTIs handled by this importer
*/
supportedTypes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
}, "strip", z.ZodTypeAny, {
path: string;
name: string;
version?: string | undefined;
supportedTypes?: string[] | undefined;
}, {
path: string;
name: string;
version?: string | undefined;
supportedTypes?: string[] | undefined;
}>;
type ImporterInfo = z.infer<typeof ImporterInfoSchema>;
/**
* Schema for attribute information
*/
declare const AttributeInfoSchema: z.ZodObject<{
/**
* Attribute name (e.g., kMDItemDisplayName)
*/
name: z.ZodString;
/**
* Localized description
*/
description: z.ZodString;
/**
* Attribute type (e.g., string, date, number)
*/
type: z.ZodOptional<z.ZodString>;
/**
* Whether the attribute is localized
*/
isLocalized: z.ZodOptional<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
name: string;
description: string;
type?: string | undefined;
isLocalized?: boolean | undefined;
}, {
name: string;
description: string;
type?: string | undefined;
isLocalized?: boolean | undefined;
}>;
type AttributeInfo = z.infer<typeof AttributeInfoSchema>;
/**
* Execute a live Spotlight search that monitors for changes in real-time.
* Returns a ChildProcess that can be killed to stop monitoring.
*
* @param {string} query - The search query
* @param {MdfindOptionsInput} options - Search options
* @param {LiveSearchEvents} events - Event handlers for results and errors
* @returns {ChildProcess} The search process
*
* @example
* ```typescript
* const search = mdfindLive('kind:image', {
* onlyIn: '~/Pictures'
* }, {
* onResult: paths => console.log('Found:', paths),
* onError: error => console.error('Error:', error),
* onEnd: () => console.log('Search ended')
* })
*
* // Stop the search after 10 seconds
* setTimeout(() => search.kill(), 10000)
* ```
*/
declare function mdfindLive(query: string, options: MdfindOptionsInput | undefined, events: LiveSearchEvents): ChildProcess;
/**
* Custom error class for mdfind-related errors.
* Provides additional context from stderr output.
*/
declare class MdfindError extends Error {
readonly stderr: string;
readonly name: "MdfindError";
constructor(message: string, stderr: string);
}
/**
* Execute a Spotlight search using the mdfind command.
* Returns an array of file paths that match the query.
*/
declare function mdfind(query: string, options?: MdfindOptionsInput): Promise<string[]>;
/**
* Get the count of files that match a Spotlight search query.
* Returns the number of matching files without retrieving their paths.
*/
declare function mdfindCount(query: string, options?: MdfindOptionsInput): Promise<number>;
/**
* Get metadata for a file using the macOS mdls command.
* Retrieves Spotlight metadata attributes and their values.
*
* @param {string} filePath - Path to the file to get metadata for
* @param {MdlsOptions} [options] - Configuration options:
* - attributes: List of specific attributes to retrieve
* - raw: Return raw attribute values without parsing
* - nullMarker: String to use for null values
* - structured: Return metadata in structured format (basic, EXIF, XMP)
*
* @returns {Promise<MetadataResult | ExtendedMetadata>}
* Object mapping attribute names to parsed values, or structured metadata
*
* @throws {Error}
* - If the file doesn't exist
* - If the file can't be read
* - If mdls command fails
*
* @example
* Get raw metadata:
* ```typescript
* const metadata = await getMetadata('photo.jpg')
* console.log(metadata.kMDItemPixelHeight)
* ```
*
* @example
* Get structured metadata:
* ```typescript
* const metadata = await getMetadata('photo.jpg', { structured: true })
* console.log(metadata.basic.name)
* console.log(metadata.exif.focalLength)
* console.log(metadata.xmp.creator)
* ```
*/
declare const getMetadata: (filePath: string, options?: Partial<MdlsOptions>) => Promise<MetadataResult | ExtendedMetadata>;
/**
* Custom error class for mdutil-related errors.
* Provides additional context about the error and whether root access is required.
*/
declare class MdutilError extends Error {
readonly stderr: string;
readonly requiresRoot: boolean;
readonly name: "MdutilError";
constructor(message: string, stderr: string, requiresRoot?: boolean);
}
/**
* Get Spotlight indexing status for a volume or directory.
* Checks if indexing is enabled and provides current status.
*
* @param {string} volumePath - Path to check indexing status for
* @param {MdutilOptions} [options] - Configuration options:
* - verbose: Include additional status details
* - resolveRealPath: Resolve symlinks to real paths (default: true)
* - excludeSystemVolumes: Filter out system volumes (default: false)
* - excludeUnknownState: Filter out volumes with unknown state (default: false)
*
* @returns {Promise<IndexStatus>} Current indexing status
*
* @throws {MdutilError}
* - If the path doesn't exist
* - If mdutil command fails
* - If root privileges are required
*/
declare const getIndexingStatus: (volumePath: string, options?: MdutilOptions) => Promise<IndexStatus>;
/**
* Get indexing status for all volumes.
* Returns an array of status objects for each volume.
*
* @param {MdutilOptions} [options] - Configuration options:
* - verbose: Include additional status details
* - resolveRealPath: Resolve symlinks to real paths (default: true)
* - excludeSystemVolumes: Filter out system volumes (default: false)
* - excludeUnknownState: Filter out volumes with unknown state (default: false)
*
* @returns {Promise<IndexStatus[]>} Array of volume statuses
*
* @throws {MdutilError}
* - If mdutil command fails
* - If root privileges are required
*/
declare const getAllVolumesStatus: (options?: MdutilOptions) => Promise<IndexStatus[]>;
/**
* Check for any existing Spotlight entries in a directory.
* This helps verify if a path is truly removed from the index.
*
* @param {string} volumePath - Path to check for entries
* @returns {Promise<string[]>} Array of indexed file paths
*
* @throws {MdutilError}
* - If the path doesn't exist
* - If the search fails
*/
declare const getIndexedEntries: (volumePath: string) => Promise<string[]>;
/**
* Enable or disable Spotlight indexing for a volume or directory.
* Also verifies the change and checks for any remaining indexed entries.
*
* @param {string} volumePath - Path to enable/disable indexing for
* @param {boolean} enable - Whether to enable (true) or disable (false) indexing
* @returns {Promise<{ success: boolean; remainingEntries: string[] }>} Status and any remaining entries
*
* @throws {MdutilError}
* - If the path doesn't exist
* - If mdutil command fails
* - If root privileges are required
*/
declare const setIndexing: (volumePath: string, enable: boolean) => Promise<{
success: boolean;
remainingEntries: string[];
}>;
/**
* Erase and rebuild the Spotlight index.
*
* Note: This operation often requires root privileges.
*
* @param {string} volumePath - Path to rebuild index for
*
* @throws {MdutilError}
* - If the path doesn't exist
* - If mdutil command fails
* - If root privileges are required
*/
declare const eraseAndRebuildIndex: (volumePath: string) => Promise<void>;
/**
* List the contents of the Spotlight index.
* Shows what files and directories are currently indexed.
*
* Note: This operation requires root privileges.
*
* @param {string} volumePath - Path to list index contents for
* @returns {Promise<string>} Index contents listing
*
* @throws {MdutilError}
* - If mdutil command fails
* - If root privileges are required
*/
declare const listIndexContents: (volumePath: string) => Promise<string>;
/**
* Get the Spotlight configuration for a volume.
* Returns the contents of VolumeConfig.plist.
*
* Note: This operation requires root privileges.
*
* @param {string} volumePath - Path to get configuration for
* @returns {Promise<string>} Volume configuration
*
* @throws {MdutilError}
* - If mdutil command fails
* - If root privileges are required
*/
declare const getVolumeConfig: (volumePath: string) => Promise<string>;
/**
* Remove the Spotlight index directory for a volume.
* Does not disable indexing, but forces Spotlight to reevaluate the volume.
*
* Note: This operation requires root privileges.
*
* @param {string} volumePath - Path to remove index for
*
* @throws {MdutilError}
* - If mdutil command fails
* - If root privileges are required
*/
declare const removeIndexDirectory: (volumePath: string) => Promise<void>;
declare const enableIndexing: (directory?: string) => Promise<void>;
declare const disableIndexing: (directory?: string) => Promise<void>;
declare const eraseIndex: (directory?: string) => Promise<void>;
/**
* Custom error class for mdimport-related errors.
* Provides additional context about the error and whether root access is required.
*/
declare class MdimportError extends Error {
readonly stderr: string;
readonly requiresRoot: boolean;
readonly name: "MdimportError";
constructor(message: string, stderr: string, requiresRoot?: boolean);
}
/**
* Debug levels for mdimport testing
*/
declare const MdimportDebugLevel: {
/** Print summary of test import */
readonly SUMMARY: 1;
/** Print summary and all attributes (except kMDItemTextContent) */
readonly ATTRIBUTES: 2;
/** Print summary and all attributes (including kMDItemTextContent) */
readonly FULL: 3;
};
/**
* Options for mdimport operations
*/
declare const MdimportOptionsSchema: z.ZodEffects<z.ZodObject<{
/**
* Test import without storing in index
* When true, the import is simulated and attributes are returned without modifying the index
* @default false
*/
test: z.ZodDefault<z.ZodBoolean>;
/**
* Debug level (requires test mode)
* - 1: Print summary of test import
* - 2: Print summary and all attributes (except kMDItemTextContent)
* - 3: Print summary and all attributes (including kMDItemTextContent)
*/
debugLevel: z.ZodOptional<z.ZodEnum<["1", "2", "3"]>>;
/**
* Output file for test results (requires test mode)
*/
outputFile: z.ZodOptional<z.ZodString>;
/**
* Show performance information (requires test mode)
* @default false
*/
showPerformance: z.ZodDefault<z.ZodBoolean>;
/**
* Maximum buffer size for output
* @default 512KB
*/
maxBuffer: z.ZodDefault<z.ZodNumber>;
/**
* Force immediate indexing
* Note: This is the default behavior if no other flags are specified
* @default true
*/
immediate: z.ZodDefault<z.ZodBoolean>;
/**
* Recursively import directories
* Note: This is always true for directory imports
* @default true
*/
recursive: z.ZodDefault<z.ZodBoolean>;
}, "strict", z.ZodTypeAny, {
maxBuffer: number;
recursive: boolean;
test: boolean;
showPerformance: boolean;
immediate: boolean;
debugLevel?: "1" | "2" | "3" | undefined;
outputFile?: string | undefined;
}, {
maxBuffer?: number | undefined;
recursive?: boolean | undefined;
test?: boolean | undefined;
debugLevel?: "1" | "2" | "3" | undefined;
outputFile?: string | undefined;
showPerformance?: boolean | undefined;
immediate?: boolean | undefined;
}>, {
maxBuffer: number;
recursive: boolean;
test: boolean;
showPerformance: boolean;
immediate: boolean;
debugLevel?: "1" | "2" | "3" | undefined;
outputFile?: string | undefined;
}, {
maxBuffer?: number | undefined;
recursive?: boolean | undefined;
test?: boolean | undefined;
debugLevel?: "1" | "2" | "3" | undefined;
outputFile?: string | undefined;
showPerformance?: boolean | undefined;
immediate?: boolean | undefined;
}>;
type MdimportOptions = z.input<typeof MdimportOptionsSchema>;
/**
* Import files or directories into the Spotlight index
* @param paths Files or directories to import
* @param options Import options
* @returns The command output as a string
* @throws {MdimportError} If the import fails
*
* @example
* Import a file:
* ```typescript
* await mdimport('document.pdf')
* ```
*
* @example
* Test import with debug info:
* ```typescript
* await mdimport('document.pdf', {
* test: true,
* debugLevel: '2'
* })
* ```
*
* @example
* Recursive directory import:
* ```typescript
* await mdimport('~/Documents')
* ```
*/
declare function mdimport(paths: string | string[], options?: MdimportOptions): Promise<string>;
/**
* List all installed Spotlight importers
* @returns Array of importer paths
* @throws {MdimportError} If the command fails
*
* @example
* ```typescript
* const importers = await listImporters()
* console.log('Found importers:', importers)
* ```
*/
declare function listImporters(): Promise<string[]>;
/**
* List all available Spotlight attributes and their localizations
* @returns Array of attribute descriptions
* @throws {MdimportError} If the command fails
*
* @example
* ```typescript
* const attributes = await listAttributes()
* console.log('Available attributes:', attributes)
* ```
*/
declare function listAttributes(): Promise<string[]>;
/**
* Print the Spotlight schema
* @returns Schema XML as a string
* @throws {MdimportError} If the command fails
*
* @example
* ```typescript
* const schema = await getSchema()
* console.log('Spotlight schema:', schema)
* ```
*/
declare function getSchema(): Promise<string>;
/**
* Reimport files for UTIs claimed by a specific importer
* @param importerPath Path to the importer (e.g., /System/Library/Spotlight/Chat.mdimporter)
* @returns Command output
* @throws {MdimportError} If the command fails
*
* @example
* ```typescript
* await reimportForImporter('/System/Library/Spotlight/Chat.mdimporter')
* ```
*/
declare function reimportForImporter(importerPath: string): Promise<string>;
/**
* A fluent interface for building and executing Spotlight queries.
*/
declare class QueryBuilder {
private query;
private options;
/**
* Create a new QueryBuilder instance
*/
constructor(options?: Partial<MdfindOptionsInput>);
/**
* Add a raw query condition.
* Useful for complex conditions or custom metadata attributes.
*
* @param {string} condition - Raw Spotlight query condition
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const files = await new QueryBuilder()
* .where('kMDItemPixelHeight > 1080')
* .where('kMDItemPixelWidth > 1920')
* .execute()
* ```
*/
where(condition: string): this;
/**
* Filter by content type (UTI).
* Common types include:
* - public.image
* - public.audio
* - public.movie
* - public.pdf
* - public.plain-text
* - public.rtf
* - public.html
* - public.font
*
* @param {string} type - Uniform Type Identifier (UTI)
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const images = await new QueryBuilder()
* .contentType('public.image')
* .execute()
* ```
*/
contentType(type: string): this;
/**
* Set the name pattern for file matching
*/
named(pattern: string): this;
/**
* Set the directory to search in
*/
inDirectory(path: string): this;
/**
* Filter by creation date.
*
* @param {Date} date - Date to compare against
* @returns {this} The builder instance for chaining
*/
createdAfter(date: Date): this;
/**
* Filter by creation date.
*
* @param {Date} date - Date to compare against
* @returns {this} The builder instance for chaining
*/
createdBefore(date: Date): this;
/**
* Filter by modification date.
*
* @param {Date} date - Date to compare against
* @returns {this} The builder instance for chaining
*/
modifiedAfter(date: Date): this;
/**
* Filter by modification date.
*
* @param {Date} date - Date to compare against
* @returns {this} The builder instance for chaining
*/
modifiedBefore(date: Date): this;
/**
* Filter by last opened date.
*
* @param {Date} date - Date to compare against
* @returns {this} The builder instance for chaining
*/
lastOpenedAfter(date: Date): this;
/**
* Filter by file size in bytes.
*
* @param {number} bytes - Minimum file size in bytes
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const files = await new QueryBuilder()
* .largerThan(1024 * 1024) // 1MB
* .execute()
* ```
*/
largerThan(bytes: number): this;
/**
* Filter by file size in bytes.
*
* @param {number} bytes - Maximum file size in bytes
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const files = await new QueryBuilder()
* .smallerThan(1024 * 100) // 100KB
* .execute()
* ```
*/
smallerThan(bytes: number): this;
/**
* Filter by file extension.
*
* @param {string} ext - File extension without dot
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const files = await new QueryBuilder()
* .extension('pdf')
* .execute()
* ```
*/
extension(ext: string): this;
/**
* Filter by author name.
*
* @param {string} name - Author's name
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const files = await new QueryBuilder()
* .author('John Doe')
* .execute()
* ```
*/
author(name: string): this;
/**
* Filter by author or artist.
* Alias for author() method with more descriptive name for media files.
*
* @param {string} name - Author or artist name
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const files = await new QueryBuilder()
* .contentType('public.audio')
* .byAuthor('Radiohead')
* .execute()
* ```
*/
byAuthor(name: string): this;
/**
* Filter by text content.
*
* @param {string} text - Text to search for
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const files = await new QueryBuilder()
* .containing('important')
* .execute()
* ```
*/
containing(text: string): this;
/**
* Enable natural language query interpretation.
*
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const files = await new QueryBuilder()
* .where('images created today')
* .interpret()
* .execute()
* ```
*/
interpret(): this;
/**
* Disable special query interpretation.
*
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const files = await new QueryBuilder()
* .where('kMDItemFSName == "*.txt"')
* .literal()
* .execute()
* ```
*/
literal(): this;
/**
* Return only the count of matches.
*
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const count = await new QueryBuilder()
* .contentType('public.image')
* .count()
* .execute()
* ```
*/
count(): this;
/**
* Return specific metadata attributes.
*
* @param {string} name - Spotlight metadata attribute
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const metadata = await new QueryBuilder()
* .contentType('public.image')
* .attribute('kMDItemPixelHeight')
* .execute()
* ```
*/
attribute(name: string): this;
/**
* Filter for files that have GPS data.
*
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const files = await new QueryBuilder()
* .contentType('public.image')
* .hasGPS()
* .execute()
* ```
*/
hasGPS(): this;
/**
* Filter for audio files with minimum quality requirements.
*
* @param {number} sampleRate - Minimum sample rate in Hz (e.g., 44100)
* @param {number} bitRate - Minimum bit rate in bits/second (e.g., 320000)
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const files = await new QueryBuilder()
* .contentType('public.audio')
* .minAudioQuality(44100, 320000)
* .execute()
* ```
*/
minAudioQuality(sampleRate: number, bitRate: number): this;
/**
* Set the operator for combining conditions
*/
useOperator(op: '&&' | '||'): this;
/**
* Filter by keyword in content or metadata.
*
* @param {string} keyword - Keyword to search for
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const files = await new QueryBuilder()
* .hasKeyword('typescript')
* .execute()
* ```
*/
hasKeyword(keyword: string): this;
/**
* Filter images by minimum dimensions.
*
* @param {number} width - Minimum width in pixels
* @param {number} height - Minimum height in pixels
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const files = await new QueryBuilder()
* .contentType('public.image')
* .minImageDimensions(1920, 1080)
* .execute()
* ```
*/
minImageDimensions(width: number, height: number): this;
/**
* Filter for application bundles.
*
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const apps = await new QueryBuilder()
* .isApplication()
* .execute()
* ```
*/
isApplication(): this;
/**
* Filter for system preference panes.
*
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const prefs = await new QueryBuilder()
* .isPreferencePane()
* .execute()
* ```
*/
isPreferencePane(): this;
/**
* Filter by Finder label color.
*
* @param {number} label - Label index (0-7)
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const files = await new QueryBuilder()
* .hasLabel(2) // Red label
* .execute()
* ```
*/
hasLabel(label: number): this;
/**
* Filter for invisible files.
*
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const files = await new QueryBuilder()
* .isInvisible()
* .execute()
* ```
*/
isInvisible(): this;
/**
* Filter by file owner.
*
* @param {number} uid - User ID
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const files = await new QueryBuilder()
* .ownedBy(501) // Standard user ID
* .execute()
* ```
*/
ownedBy(uid: number): this;
/**
* Filter by encoding application.
*
* @param {string} appName - Application name
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const files = await new QueryBuilder()
* .encodedBy('Adobe Photoshop')
* .execute()
* ```
*/
encodedBy(appName: string): this;
/**
* Filter by musical genre.
*
* @param {string} genre - Musical genre
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const files = await new QueryBuilder()
* .contentType('public.audio')
* .inGenre('Jazz')
* .execute()
* ```
*/
inGenre(genre: string): this;
/**
* Filter by recording year.
*
* @param {number} year - Recording year
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const files = await new QueryBuilder()
* .contentType('public.audio')
* .recordedIn(2024)
* .execute()
* ```
*/
recordedIn(year: number): this;
/**
* Filter by album name.
*
* @param {string} name - Album name
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const files = await new QueryBuilder()
* .contentType('public.audio')
* .inAlbum('Greatest Hits')
* .execute()
* ```
*/
inAlbum(name: string): this;
/**
* Filter by composer.
*
* @param {string} name - Composer name
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const files = await new QueryBuilder()
* .contentType('public.audio')
* .byComposer('Mozart')
* .execute()
* ```
*/
byComposer(name: string): this;
/**
* Filter by camera make.
*
* @param {string} make - Camera manufacturer
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const files = await new QueryBuilder()
* .contentType('public.image')
* .takenWith('Canon')
* .execute()
* ```
*/
takenWith(make: string): this;
/**
* Filter by camera model.
*
* @param {string} model - Camera model
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const files = await new QueryBuilder()
* .contentType('public.image')
* .usingModel('EOS R5')
* .execute()
* ```
*/
usingModel(model: string): this;
/**
* Filter by ISO speed.
*
* @param {number} min - Minimum ISO speed
* @param {number} max - Maximum ISO speed
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const files = await new QueryBuilder()
* .contentType('public.image')
* .withISO(100, 400)
* .execute()
* ```
*/
withISO(min: number, max: number): this;
/**
* Filter by focal length.
*
* @param {number} min - Minimum focal length in mm
* @param {number} max - Maximum focal length in mm
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const files = await new QueryBuilder()
* .contentType('public.image')
* .withFocalLength(24, 70)
* .execute()
* ```
*/
withFocalLength(min: number, max: number): this;
/**
* Filter by color space.
*
* @param {string} colorSpace - Color space name (e.g., 'RGB', 'CMYK')
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const files = await new QueryBuilder()
* .contentType('public.image')
* .inColorSpace('RGB')
* .execute()
* ```
*/
inColorSpace(colorSpace: string): this;
/**
* Filter by bits per sample.
*
* @param {number} bits - Bits per sample
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const files = await new QueryBuilder()
* .contentType('public.image')
* .withBitDepth(16)
* .execute()
* ```
*/
withBitDepth(bits: number): this;
/**
* Set the maximum buffer size for the search results.
*
* @param {number} bytes - Maximum buffer size in bytes
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const files = await new QueryBuilder()
* .maxBuffer(5 * 1024 * 1024) // 5MB buffer
* .execute()
* ```
*/
maxBuffer(bytes: number): this;
/**
* Filter for text-based content.
*
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const files = await new QueryBuilder()
* .isText()
* .execute()
* ```
*/
isText(): this;
/**
* Filter for composite content.
*
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const files = await new QueryBuilder()
* .isComposite()
* .execute()
* ```
*/
isComposite(): this;
/**
* Filter for audiovisual content.
*
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const files = await new QueryBuilder()
* .isAudiovisual()
* .execute()
* ```
*/
isAudiovisual(): this;
/**
* Filter for bundle content.
*
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const files = await new QueryBuilder()
* .isBundle()
* .execute()
* ```
*/
isBundle(): this;
/**
* Filter for Markdown files.
*
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const files = await new QueryBuilder()
* .isMarkdown()
* .execute()
* ```
*/
isMarkdown(): this;
/**
* Filter for property list files.
*
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const files = await new QueryBuilder()
* .isPlist()
* .execute()
* ```
*/
isPlist(): this;
/**
* Filter for PDF documents.
*
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const files = await new QueryBuilder()
* .isPDF()
* .execute()
* ```
*/
isPDF(): this;
/**
* Filter for JSON files.
*
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const files = await new QueryBuilder()
* .isJSON()
* .execute()
* ```
*/
isJSON(): this;
/**
* Filter for YAML files.
*
* @returns {this} The builder instance for chaining
*
* @example
* ```typescript
* const files = await new QueryBuilder()
* .isYAML()
* .execute()
* ```
*/
isYAML(): this;
/**
* Convert the query to a string
*/
toString(): string;
/**
* Execute the search query
*/
execute(): Promise<string[]>;
/**
* Execute the search query with live updates
* @param onResult Callback function that receives each result as it arrives
* @param onComplete Optional callback function called when the search completes
*/
executeLive(onResult: (result: string) => void, onComplete?: (results: string[]) => void): Promise<void>;
/**
* Filter by file types using name patterns
*/
withFileTypes(types: string[]): this;
}
/**
* @deprecated Use QueryBuilder instead. SpotlightQuery will be removed in the next major version.
*/
declare const SpotlightQuery: typeof QueryBuilder;
interface BatchSearchOptions extends MdfindOptionsInput {
query: string;
}
/**
* Run multiple mdfind queries in parallel.
* Each query can have its own options.
*
* @param {BatchSearchOptions[]} searches - Array of search queries and options
* @returns {Promise<string[][]>} Array of results for each query
*
* @example
* ```typescript
* const results = await batchSearch([
* { query: 'kind:image', options: { onlyIn: '~/Pictures' } },
* { query: 'kind:pdf', options: { onlyIn: '~/Documents' } }
* ])
* ```
*/
declare function batchSearch(searches: {
query: string;
options?: MdfindOptionsInput;
}[]): Promise<string[][]>;
/**
* Run multiple mdfind queries sequentially.
* Each query can have its own options.
*
* @param {BatchSearchOptions[]} searches - Array of search queries and options
* @returns {Promise<string[][]>} Array of results for each query
*
* @example
* ```typescript
* const results = await batchSearchSequential([
* { query: 'kind:image', options: { onlyIn: '~/Pictures' } },
* { query: 'kind:pdf', options: { onlyIn: '~/Documents' } }
* ])
* ```
*/
declare function batchSearchSequential(searches: {
query: string;
options?: MdfindOptionsInput;
}[]): Promise<string[][]>;
/**
* Run the same Spotlight search across multiple directories in parallel.
* This is useful for searching across different locations with the same criteria.
*
* @param {string} query - The Spotlight query to execute
* @param {string[]} directories - Array of directories to search in
* @param {MdfindOptionsInput} [options] - Additional search options
* @returns {Promise<string[][]>} Results for each directory
*
* @example
* ```typescript
* const results = await mdfindMultiDirectory(
* 'kind:image',
* ['~/Pictures', '~/Documents'],
* { attributes: ['kMDItemPixelHeight'] }
* )
* ```
*/
declare function mdfindMultiDirectory(query: string, directories: string[], options?: Omit<MdfindOptionsInput, 'onlyInDirectory'>): Promise<string[][]>;
/**
* Run multiple Spotlight queries against the same directory in parallel.
* This is useful for searching with different criteria in the same location.
*
* @param {string[]} queries - Array of Spotlight queries to execute
* @param {string} directory - Directory to limit the search to
* @param {MdfindOptionsInput} [options] - Additional search options
* @returns {Promise<string[][]>} Results for each query
*
* @example
* ```typescript
* const results = await mdfindMultiQuery(
* [
* 'kind:image',
* 'kind:audio',
* 'kind:movie'
* ],
* '~/Downloads'
* )
* ```
*/
declare function mdfindMultiQuery(queries: string[], directory: string, options?: Omit<MdfindOptionsInput, 'onlyInDirectory'>): Promise<string[][]>;
/**
* Get basic metadata for a file.
* @param filePath Path to the file
* @returns Basic metadata including name, size, dates, and type
*/
declare function getBasicMetadata(filePath: string): Promise<BasicMetadata>;
/**
* Get EXIF metadata for an image file.
* @param filePath Path to the image file
* @returns EXIF metadata including camera info and settings
*/
declare function getExifData(filePath: string): Promise<ExifData>;
/**
* Get XMP metadata for a file.
* @param filePath Path to the file
* @returns XMP metadata including document info and rights
*/
declare function getXMPData(filePath: string): Promise<XMPData>;
/**
* Get all available metadata for a file.
* @param filePath Path to the file
* @returns Combined metadata from basic, EXIF, and XMP sources
*/
declare function getExtendedMetadata(filePath: string): Promise<{
basic: BasicMetadata;
exif: Partial<ExifData>;
xmp: Partial<XMPData>;
}>;
/**
* Interface for Spotlight attribute definitions.
* Describes metadata attributes available in Spotlight searches.
*
* Properties:
* - name: Attribute identifier (e.g., 'kMDItemDisplayName')
* - description: Human-readable description
* - type: Data type of the attribute value
* - example: Optional example value
* - category: Functional category for organization
*
* Data types:
* - string: Text values and identifiers
* - number: Numeric measurements and counts
* - date: Timestamps and calendar dates
* - boolean: True/false flags
* - array: Lists of values
*
* Categories:
* - general: Basic file properties
* - document: Document-specific metadata
* - media: Audio/video properties
* - image: Image-specific properties
* - audio: Audio-specific properties
* - location: Geographic information
* - system: Operating system metadata
*/
interface SpotlightAttributeDefinition {
name: string;
description: string;
type: 'string' | 'number' | 'date' | 'boolean' | 'array';
example?: string | number | boolean | string[];
category: 'general' | 'document' | 'media' | 'image' | 'audio' | 'location' | 'system';
}
/**
* Common content types with descriptions.
* Maps Uniform Type Identifiers (UTIs) to human-readable descriptions.
*
* Categories:
* - Images: JPEG, PNG, etc.
* - Audio: MP3, WAV, etc.
* - Video: MP4, MOV, etc.
* - Documents: PDF, text, RTF
* - Web: HTML, XML
* - System: Archives, executables
*
* @example
* Using content types:
* ```typescript
* console.log(CONTENT_TYPES['public.image'])
* // Output: "Image files (JPEG, PNG, etc.)"
*
* console.log(CONTENT_TYPES['public.audio'])
* // Output: "Audio files (MP3, WAV, etc.)"
* ```
*
* @example
* Checking file type:
* ```typescript
* const type = 'public.pdf'
* if (type in CONTENT_TYPES) {
* console.log(`File type: ${CONTENT_TYPES[type]}`)
* }
* ```
*/
declare const CONTENT_TYPES: {
readonly 'public.item': "Base type for all items";
readonly 'public.content': "Base type for all content";
readonly 'public.data': "Generic data files";
readonly 'public.text': "Text-based content";
readonly 'public.composite-content': "Content with multiple parts";
readonly 'public.image': "Image files (JPEG, PNG, etc.)";
readonly 'public.jpeg': "JPEG Image";
readonly 'public.png': "PNG Image";
readonly 'public.heic': "HEIC Image";
readonly 'com.apple.icns': "Apple Icon Image";
readonly 'public.audio': "Audio files (MP3, WAV, etc.)";
readonly 'public.movie': "Video files (MP4, MOV, etc.)";
readonly 'public.audiovisual-content': "Audio/Visual content";
readonly 'public.mp3': "MP3 Audio";
readonly 'public.mp4': "MP4 Video";
readonly 'public.mpeg-4': "MPEG-4 Media";
readonly 'public.mpeg-2-transport-stream': "MPEG-2 Transport Stream";
readonly 'com.apple.quicktime-movie': "QuickTime Movie";
readonly 'public.plain-text': "Plain text files";
readonly 'public.rtf': "Rich Text Format documents";
readonly 'public.html': "HTML documents";
readonly 'public.xml': "XML documents";
readonly 'public.pdf': "PDF documents";
readonly 'com.adobe.pdf': "Adobe PDF Document";
readonly 'net.daringfireball.markdown': "Markdown Document";
readonly 'public.source-code': "Source Code File";
readonly 'public.shell-script': "Shell Script";
readonly 'public.swift-source': "Swift Source File";
readonly 'public.python-script': "Python Script";
readonly 'public.json': "JSON File";
readonly 'public.yaml': "YAML File";
readonly 'public.directory': "Directory/Folder";
readonly 'public.folder': "Folders/Directories";
readonly 'com.apple.bundle': "Generic Bundle";
readonly 'com.apple.package': "macOS Package Bundle";
readonly 'com.apple.application': "Generic Application";
readonly 'com.apple.application-bundle': "macOS Application Bundle";
readonly 'com.apple.application-file': "macOS Application File";
readonly 'com.apple.localizable-name-bundle': "Bundle with Localizable Name";
readonly 'public.executable': "Executable files";
readonly 'com.apple.property-list': "Property List (plist)";
readonly 'com.apple.systempreference': "System Preference";
readonly 'com.apple.plugin': "Plugin Bundle";
readonly 'com.apple.framework': "Framework Bundle";
readonly 'public.archive': "Archive files (ZIP, etc.)";
readonly 'public.font': "Font files";
readonly 'com.apple.keynote.key': "Keynote Presentation";
readonly 'com.apple.numbers.numbers': "Numbers Spreadsheet";
readonly 'com.apple.pages.pages': "Pages Document";
readonly 'com.apple.mail.emlx': "Apple Mail Message";
};
declare const getAttributeDefinition: (name: string) => SpotlightAttributeDefinition | undefined;
declare const getAttributesByCategory: (category: SpotlightAttributeDefinition["category"]) => SpotlightAttributeDefinition[];
declare const getContentTypeDescription: (contentType: keyof typeof CONTENT_TYPES) => string;
/**
* Get all available Spotlight attributes for a file using mdimport.
* This function uses the macOS mdimport command to discover all attributes
* that are available for a specific file.
*
* @param {string} filePath - The path to the file to analyze
* @returns {Record<string, string>} A map of attribute names to their descriptions
* @throws {Error} If the mdimport command fails or the file cannot be accessed
*
* @example
* ```typescript
* const attributes = discoverAttributes('path/to/file.jpg')
* console.log(attributes.kMDItemPixelHeight) // "Height of the image in pixels"
* ```
*/
declare const discoverAttributes: (filePath: string) => Record<string, string>;
/**
* Get all known content types with their descriptions.
* Returns a map of content type identifiers to human-readable descriptions.
*
* @returns {typeof CONTENT_TYPES} A map of content types to their descriptions
*
* @example
* ```typescript
* const types = getContentTypes()
* console.log(types['public.image']) // "Image files (JPEG, PNG, etc.)"
* ```
*/
declare const getContentTypes: () => typeof CONTENT_TYPES;
/**
* Get all known Spotlight attributes with their descriptions and metadata.
* Returns an array of attribute definitions including type information,
* descriptions, examples, and categories.
*
* @returns {SpotlightAttributeDefinition[]} Array of attribute definitions
*
* @example
* ```typescript
* const attrs = getSpotlightAttributes()
* const imageAttrs = attrs.filter(a => a.category === 'image')
* ```
*/
declare const getSpotlightAttributes: () => SpotlightAttributeDefinition[];
/**
* Search for attributes by name or description.
* Performs a case-insensitive search across attribute names and descriptions.
*
* @param {string} query - The search query
* @returns {SpotlightAttributeDefinition[]} Array of matching attribute definitions
*
* @example
* ```typescript
* const imageAttrs = searchAttributes('image')
* const dateAttrs = searchAttributes('creation date')
* ```
*/
declare const searchAttributes: (query: string) => SpotlightAttributeDefinition[];
export { type AttributeInfo, type BatchSearchOptions, type ExifData, type ExtendedMetadata, type ImporterInfo, type IndexStatus, type LiveSearchEvents, MdfindError, MdimportDebugLevel, MdimportError, type MdimportOptions$1 as MdimportOptions, MdimportOptionsSchema, type MdimportResult, type MdlsOptions, MdutilError, type MdutilOptions, type MetadataResult, QueryBuilder, type SpotlightAttribute, type SpotlightContentType, SpotlightQuery, type XMPData, batchSearch, batchSearchSequential, disableIndexing, discoverAttributes, enableIndexing, eraseAndRebuildIndex, eraseIndex, getAllVolumesStatus, getAttributeDefinition, getAttributesByCategory, getBasicMetadata, getContentTypeDescription, getContentTypes, getExifData, getExtendedMetadata, getIndexedEntries, getIndexingStatus, getMetadata, getSchema, getSpotlightAttributes, getVolumeConfig, getXMPData, listAttributes, listImporters, listIndexContents, mdfind, mdfindCount, mdfindLive, mdfindMultiDirectory, mdfindMultiQuery, mdimport, reimportForImporter, removeIndexDirectory, searchAttributes, setIndexing };