ts-mdls
Version:
Lightweigth, dependency free, fully typed wrapper of the macOS `mdls` command
41 lines (40 loc) • 1.28 kB
TypeScript
import { MetadataAttributeKeyArray, MetadataAttributes, MetadataObjectFromArray } from "./types";
/**
* Get the metadata attributes for the specified file/folder
*
* @param path Path of the file/folder to get the metadata attributes for
* @returns A promise for an object containing metadata attributes
*
* @example
* (async () => {
* try {
* const data = await mdls("./src/index.ts");
* console.log(data);
* } catch (error) {
* console.log(error);
* }
* })();
*/
declare function mdls(path: string): Promise<MetadataAttributes>;
/**
* Get the metadata attributes for the specified file/folder
*
* @param path Path of the file/folder to get the metadata attributes for
* @param attributeKeys Get only the metadata attribute values of the provided keys
* @returns A promise for an object containing the selected metadata attributes
*
* @example
* (async () => {
* try {
* const data = await mdls("./src/index.ts", [
* "kMDItemUserTags",
* "kMDItemFSCreationDate",
* ]);
* console.log(data);
* } catch (error) {
* console.log(error);
* }
* })();
*/
declare function mdls<T extends MetadataAttributeKeyArray>(path: string, attributeKeys: T): Promise<MetadataObjectFromArray<T>>;
export default mdls;