ts-mdls
Version:
Lightweigth, dependency free, fully typed wrapper of the macOS `mdls` command
155 lines (153 loc) • 7.04 kB
text/typescript
import {
parseString,
parseDate,
parseBoolean,
parseStringArray,
parseDateArray,
parseIntArray,
checkNull,
} from "./parsers";
export const metadatAttributeParsers = {
_kMDItemOwnerUserID: checkNull(parseInt),
_kMDItemDisplayNameWithExtensions: checkNull(parseString),
kMDItemAlternateNames: checkNull(parseStringArray),
kMDItemAcquisitionMake: checkNull(parseString),
kMDItemAcquisitionModel: checkNull(parseString),
kMDItemAlbum: checkNull(parseString),
kMDItemAperture: checkNull(parseString),
kMDItemAppleLoopDescriptors: checkNull(parseStringArray),
kMDItemAppleLoopsKeyFilterType: checkNull(parseString),
kMDItemAppleLoopsLoopMode: checkNull(parseString),
kMDItemAppleLoopsRootKey: checkNull(parseString),
kMDItemAttributeChangeDate: checkNull(parseDate),
kMDItemAudiences: checkNull(parseStringArray),
kMDItemAudioBitRate: checkNull(parseFloat),
kMDItemAudioChannelCount: checkNull(parseInt),
kMDItemAudioEncodingApplication: checkNull(parseString),
kMDItemAudioSampleRate: checkNull(parseFloat),
kMDItemAudioTrackNumber: checkNull(parseInt),
kMDItemAuthors: checkNull(parseStringArray),
kMDItemAuthorAddresses: checkNull(parseStringArray),
kMDItemBitsPerSample: checkNull(parseInt),
kMDItemCity: checkNull(parseString),
kMDItemCodecs: checkNull(parseStringArray),
kMDItemColorSpace: checkNull(parseString),
kMDItemComment: checkNull(parseString),
kMDItemComposer: checkNull(parseString),
kMDItemContactKeywords: checkNull(parseStringArray),
kMDItemContentCreationDate: checkNull(parseDate),
kMDItemContentCreationDate_Ranking: checkNull(parseDate),
kMDItemContentModificationDate: checkNull(parseDate),
kMDItemContentModificationDate_Ranking: checkNull(parseDate),
kMDItemContentType: checkNull(parseString),
kMDItemContentTypeTree: checkNull(parseStringArray),
kMDItemContributors: checkNull(parseStringArray),
kMDItemCopyright: checkNull(parseString),
kMDItemCountry: checkNull(parseString),
kMDItemCoverage: checkNull(parseString),
kMDItemCreator: checkNull(parseString),
kMDItemDateAdded: checkNull(parseDate),
kMDItemDateAdded_Ranking: checkNull(parseDate),
kMDItemDeliveryType: checkNull(parseString),
kMDItemDescription: checkNull(parseString),
kMDItemDisplayName: checkNull(parseString),
kMDItemDownloadedDate: checkNull(parseDateArray),
kMDItemDueDate: checkNull(parseDate),
kMDItemDurationSeconds: checkNull(parseFloat),
kMDItemEmailAddresses: checkNull(parseStringArray),
kMDItemEncodingApplications: checkNull(parseStringArray),
kMDItemEXIFVersion: checkNull(parseString),
kMDItemExposureMode: checkNull(parseInt),
kMDItemDocumentIdentifier: checkNull(parseInt),
kMDItemExposureProgram: checkNull(parseString),
kMDItemExposureTimeSeconds: checkNull(parseFloat),
kMDItemExposureTimeString: checkNull(parseString),
kMDItemFinderComment: checkNull(parseString),
kMDItemFlashOnOff: checkNull(parseBoolean),
kMDItemFNumber: checkNull(parseFloat),
kMDItemFocalLength: checkNull(parseFloat),
kMDItemFonts: checkNull(parseStringArray),
kMDItemFSContentChangeDate: checkNull(parseDate),
kMDItemFSCreationDate: checkNull(parseDate),
kMDItemFSCreatorCode: checkNull(parseString),
kMDItemFSFinderFlags: checkNull(parseInt),
kMDItemFSHasCustomIcon: checkNull(parseInt),
kMDItemFSInvisible: checkNull(parseBoolean),
kMDItemFSIsExtensionHidden: checkNull(parseBoolean),
kMDItemFSIsStationery: checkNull(parseBoolean),
kMDItemFSLabel: checkNull(parseInt),
kMDItemFSName: checkNull(parseString),
kMDItemFSNodeCount: checkNull(parseInt),
kMDItemFSOwnerGroupID: checkNull(parseInt),
kMDItemFSOwnerUserID: checkNull(parseInt),
kMDItemFSSize: checkNull(parseInt),
kMDItemFSTypeCode: checkNull(parseString),
kMDItemHasAlphaChannel: checkNull(parseBoolean),
kMDItemHeadline: checkNull(parseString),
kMDItemIdentifier: checkNull(parseString),
kMDItemInstantMessageAddresses: checkNull(parseStringArray),
kMDItemInstructions: checkNull(parseStringArray),
kMDItemIsGeneralMIDISequence: checkNull(parseBoolean),
kMDItemISOSpeed: checkNull(parseInt),
kMDItemKeySignature: checkNull(parseString),
kMDItemKeywords: checkNull(parseStringArray),
kMDItemKind: checkNull(parseString),
kMDItemLanguages: checkNull(parseStringArray),
kMDItemLastUsedDate: checkNull(parseDate),
kMDItemLastUsedDate_Ranking: checkNull(parseDate),
kMDItemInterestingDate_Ranking: checkNull(parseDate),
kMDItemLayerNames: checkNull(parseStringArray),
kMDItemLogicalSize: checkNull(parseInt),
kMDItemLyricist: checkNull(parseString),
kMDItemMaxAperture: checkNull(parseFloat),
kMDItemMediaTypes: checkNull(parseStringArray),
kMDItemMeteringMode: checkNull(parseString),
kMDItemMusicalGenre: checkNull(parseString),
kMDItemMusicalInstrumentCategory: checkNull(parseString),
kMDItemMusicalInstrumentName: checkNull(parseString),
kMDItemNamedLocation: checkNull(parseString),
kMDItemNumberOfPages: checkNull(parseInt),
kMDItemOrganizations: checkNull(parseStringArray),
kMDItemOrientation: checkNull(parseInt),
kMDItemPageHeight: checkNull(parseFloat),
kMDItemPageWidth: checkNull(parseFloat),
kMDItemParticipants: checkNull(parseStringArray),
kMDItemPath: checkNull(parseString),
kMDItemPhoneNumbers: checkNull(parseStringArray),
kMDItemPhysicalSize: checkNull(parseInt),
kMDItemPixelCount: checkNull(parseInt),
kMDItemPixelHeight: checkNull(parseInt),
kMDItemPixelWidth: checkNull(parseInt),
kMDItemProfileName: checkNull(parseString),
kMDItemProjects: checkNull(parseStringArray),
kMDItemPublishers: checkNull(parseStringArray),
kMDItemRecipients: checkNull(parseStringArray),
kMDItemRecipientAddresses: checkNull(parseStringArray),
kMDItemRecordingDate: checkNull(parseDate),
kMDLabel_26x2uentpjgt7lka65qdcazuya: checkNull(parseDate),
kMDItemRecordingYear: checkNull(parseInt),
kMDItemRedEyeOnOff: checkNull(parseBoolean),
kMDItemResolutionHeightDPI: checkNull(parseFloat),
kMDItemResolutionWidthDPI: checkNull(parseFloat),
kMDItemRights: checkNull(parseString),
kMDItemSecurityMethod: checkNull(parseString),
kMDItemStarRating: checkNull(parseFloat),
kMDItemStateOrProvince: checkNull(parseString),
kMDItemStreamable: checkNull(parseBoolean),
kMDItemTempo: checkNull(parseFloat),
kMDItemTextContent: checkNull(parseString),
kMDItemTimeSignature: checkNull(parseString),
kMDItemTitle: checkNull(parseString),
kMDItemTotalBitRate: checkNull(parseFloat),
kMDItemUseCount: checkNull(parseInt),
kMDItemUsedDates: checkNull(parseDateArray),
kMDItemUserCreatedDate: checkNull(parseDateArray),
kMDItemUserCreatedUserHandle: checkNull(parseStringArray),
kMDItemVersion: checkNull(parseString),
kMDItemVideoBitRate: checkNull(parseFloat),
kMDItemWhereFroms: checkNull(parseStringArray),
kMDItemWhiteBalance: checkNull(parseInt),
kMDItemUserModifiedUserHandle: checkNull(parseIntArray),
kMDItemUserModifiedDate: checkNull(parseDateArray),
kMDItemUserTags: checkNull(parseStringArray),
};