npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

lacona-api

v1.5.1

Published

Cross-platform API for use with lacona commands

Readme

lacona-api

Cross-platform API for use with Lacona commands

Environment Detection

isOSX

isOSX -> Boolean

Returns true if the system is running on Mac OSX.

isDemo

isDemo -> Boolean

Returns true if the system is running in a Demo environment.

Javascript Helpers

The Lacona Javascript execution environment does not include a few common JS features - Lacona reimplements them.

setTimeout

setTimeout(done: Callback<Any>, ms: Number) -> Any

Calls done after ms ms. Returns an opaque value which can be passed to clearTimeout.

clearTimeout

clearTimeout(opaque: Any)

Cancels a timeout started by setTimeout.

Low-level functions

Use these for implementing new functionality that is not provided by lacona-api. If you have functionality that you believe would be useful to other commands, please open an issue and work toward adding it to the core - that will provide improved performance and reliability across platforms.

runApplescript

runApplescript({script: String}, done: Callback<Any>)

Run script as an applescript script. Any value returned will be exported as a JSON object and provided to done.

======= This function does nothing if run on non-OSX environments.

fetchSpotlight

fetchSpotlight({
  query: String,
  attributes: Array<String>,
  directories: Array<String>,
  limit: Integer
}) -> Promise<Array<Object>>
=======

Queries Spotlight once and closes the query. Returns an Promise.

watchSpotlight

watchSpotlight({
  query: String,
  attributes: Array<String>,
  directories: Array<String>,
  limit: Integer
}) -> Observable<Array<Object>>

Queries Spotlight, and returns an Observable, which emits the entire query results everytime new data is found.

Cancels the query when unsubscribed.

callNode

No longer used, as all Lacona commands now have access to a full node.js environment

callSystem

No longer use - use child_process instead

showNotification

showNotification({
  title: String,
  subtitle: String,
  content: String
}, done: Callback<void>)

Displays an OS notification (using Notification Center, on OSX).

fetchUserDefaults

fetchUserDefaults({
  domain: String,
  key: String
}, done: Callback<Any>)

Fetch system defaults. If no key is provided, it will fetch an Object representing the entire domain. Equivalent to using defaults read.

Opening Things

openURL

openURL({url: String}) -> void

Opens a given URL (with a protocol) in the default handler.

openFile

openFile({path: String}) -> void

Opens a given file in the default handler. Leading ~ will be expanded.

Working with Applications

fetchApplications

fetchApplications({
  directories: Array<String>,
  appPaths: Array<String>
}) -> Observable<{name: String, bundleId: String}>

Creates a live spotlight query for Applications - recursively searching the given directories, and adding the apps at appPaths

launchApplication

launchApplication({bundleId: String})

openURLInApplication

openURLInApplication({url: String, bundleId: String})

openFileInApplication

openFileInApplication({path: String, bundleId: String})

bundleIdForApplication

bundleIdForApplication({name}) -> String

Syncronously returns the Bundle ID for a given application name.

bundleIdForApplication({name: "Safari"}) === "com.apple.safari"

Contacts, Calendars, and Reminders

createEvent

createEvent({
  title: String,
  start: Date,
  end: Date,
  allDay: Boolean
}, done: Callback<void>)

Creates an event on the default calendar. Calls done with an error or nothing.

createReminder

createReminder({
  title: String,
  date: Date
}) -> void

Creates a reminder on the default list. Calls `done` with an error or nothing.

### fetchUserContact

```js
fetchUserContact(Callback<Object>)

Returns the contact that the user has set as their own.

fetchContacts

fetchContacts(Callback<Object>)

Returns all contacts on the system.

## Working with Bookmarks

### fetchBookmarks

```js
fetchBookmarks() -> Observable<{name:String, url: String}>

Creates a live spotlight query for Bookmarks. url can be opened using openUrl({url}).

Working with Files

searchFiles

searchFiles({
  query: String
}) -> Observable<{path: String, contentType: String}>

Creates a non-live spotlight query that searches filenames for a given string. This search is case- and diacritic-insensitive. It does not search applications, system files, bookmarks, contacts, browser history, calendar events, or chat transcripts.

fetchDirectoryContents

fetchDirectoryContents({path: String}, done: Callback<Array<Object>>)

Returns the contents of a given directory.

userHome

userHome() -> String

Returns the user's home directory.

Working with Mounted Volumes

fetchMountedVolumes

unmountVolume

unmountAllVolumes

Working with Running Applications

fetchRunningApplications

activateApplication

hideApplication

quitApplication

Working with Application Windows

closeApplicationWindows

fetchOpenWindows

closeOpenWindow

activateOpenWindow

Working with Browser Tabs

fetchBrowserTabs

activateBrowserTab

closeBrowserTab

Working with Preference Panes

fetchPreferencePanes

Working with iTunes

fetchMusic

playSongIds

musicPlay

musicPause

musicNext

musicPrevious

musicStop

Working with System Settings

setBluetooth

checkBluetooth

setDarkMode

checkDarkMode

setWifi

checkWifi

setDoNotDisturb

checkDoNotDisturb

setVolume

checkVolume

System Events

shutdown

restart

logOut

sleep

lock

hibernate

turnOffDisplay

turnOnScreensaver

emptyTrash

openLaconaPreferences

reloadAddons