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 🙏

© 2026 – Pkg Stats / Ryan Hefner

motion-project-api

v2.0.4

Published

API for https://motion-project.github.io/

Downloads

31

Readme

Motion API

This library aims to expose a simplistic API for the https://motion-project.github.io/ project.

Installation

npm i motion-project-api

Usage

Example creating a snapshot with the camera 1.

let motionApi = new MotionApi("http://localhost:7999"); // URL of the motion web server
motionApi.getCamera(1).createSnapshot(); // creates a snapshot for the camera 1

API

Class MotionApi

MotionApi(apiUrl)

  • apiUrl - (string) The motion web server url.

getCamera(idCamera): Camera

  • idCamera - (number) The camera number to control.

Returns an instance of Camera.

Class Camera

Camera(id)

  • id - (number) The camera number to control.

getConfigList(): Promise<string>

Lists all the configuration values for the camera.

setConfig(parm, value1): Promise<void>

  • parm - (string) Name of the parameter
  • value1 - (string) New value of the specified parameter

Set the value for the requested parameter.

getConfig(parm): Promise<string>

  • parm - (string) The name of the parameter

Return the value currently set for the parameter.

writeConfig(): Promise<string>

Write the current parameters to the file.

getDetectionStatus(): Promise<MotionDetectionStatus>

Return the current status of the camera. MotionDetectionStatus.ENABLE is enable or MotionDetectionStatus.DISABLE if disabled.

getConnectionStatus(): Promise<MotionConnectionStatus>

Return the connection status of the camera. MotionConnectionStatus.OK if well connected otherwise MotionConnectionStatus.DISCONNECTED.

startDetection(): Promise<string>

Start or resume motion detection.

pauseDetection(): Promise<string>

Pause the motion detection. When the action of pause is executed, Motion will stop the motion detection processing and of course all events but will continue to process and decode images from the camera. This allows for a faster transition when the user executes a start.

startEvent(): Promise<string>

Trigger a new event.

endEvent(): Promise<string>

Trigger the end of a event.

createSnapshot(): Promise<void>

Create a snapshot

restart(): Promise<string>

Shutdown and restart Motion.

quit(): Promise<string>

Close all connections to the camera. The quit action conversely not only stops the motion detection but also disconnects from the camera and decoding of images. To start motion detection after a quit, the user must execute a restart which will reinitialize the connection to the camera. And since the camera was completely disconnect, it can take more than a few seconds for Motion to fully start and have the camera available for processing or viewing.

end(): Promise<string>

Entirely shutdown the Motion application. This option completely terminates the Motion application. It closes all connections to all the cameras and terminates the application. This may be required when running Motion in daemon mode. Note that there is no way to restart the Motion application from the webcontrol interface after processing a end request.