node-spotlight

1.0.0 • Public • Published

node-spotlight

Search macOS using Spotlight.

npm version ISC-licensed minimum Node.js version support me via GitHub Sponsors chat with me on Twitter

Installing

npm install node-spotlight

Usage

spotlight(query, directory, attributes)
const spotlight = require('node-spotlight')

const results = spotlight('bvg-wlan', null, [
	'kMDItemAuthors',
	'kMDItemContentType',
	'kMDItemFSInvisible',
	'kMDItemKind',
	'kMDItemNumberOfPages',
	'kMDItemTitle',
	'kMDItemUseCount',
	'kMDItemVersion',
])
for await (const result of results) {
	console.log('result', result)
}
{
	path: '/Users/j/Downloads/bvg/bvg-wlan.pdf',
	kMDItemAuthors: ['BVG VBA-FGI Kartographie'],
	kMDItemContentType: 'com.adobe.pdf',
	kMDItemFSInvisible: false,
	kMDItemKind: 'Portable Document Format (PDF)',
	kMDItemNumberOfPages: 1,
	kMDItemTitle: 'S+U-Bahn_2901_2016_18-10_WLAN',
	kMDItemUseCount: 15,
	kMDItemVersion: '1.6'
}
// …

API

spotlight(query, dir = null, filters = [])
  • query must be a string.
  • dir is an optional string.
  • filters is an optional array if attributes that should be filtered by.

Returns an async iterator/iterable of search results.

Contributing

If you have a question, found a bug or want to propose a feature, have a look at the issues page.

Dependents (1)

Package Sidebar

Install

npm i node-spotlight

Weekly Downloads

1

Version

1.0.0

License

ISC

Unpacked Size

11.7 kB

Total Files

9

Last publish

Collaborators

  • derhuerst