# nodejs-windows-service-controller

> A module for NodeJS which allows for interaction with windows services

Latest version **1.1.3** (published 2019-04-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install nodejs-windows-service-controller
pnpm add nodejs-windows-service-controller
yarn add nodejs-windows-service-controller
bun add nodejs-windows-service-controller
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.3 |
| Published | 2019-04-17 |
| First published | 2018-11-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 661.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Callum Law |
| Maintainers | calme1709 |
| Keywords | Windows, Service, Controller |

## Links

- npm: https://www.npmjs.com/package/nodejs-windows-service-controller
- Repository: https://github.com/Calme1709/NodeJS-Windows-Services-Controller
- Homepage: https://github.com/Calme1709/NodeJS-Windows-Services-Controller#readme
- Issues: https://github.com/Calme1709/NodeJS-Windows-Services-Controller/issues
- npm.io page: https://npm.io/package/nodejs-windows-service-controller

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.1.3 (latest) — 2019-04-17
- 1.1.2 — 2018-12-09
- 1.1.1 — 2018-12-09
- 1.1.0 — 2018-11-26
- 1.0.6 — 2018-11-24
- 1.0.5 — 2018-11-24
- 1.0.4 — 2018-11-24
- 1.0.3 — 2018-11-24
- 1.0.2 — 2018-11-23
- 1.0.1 — 2018-11-23
- 1.0.0 — 2018-11-23

## README

# NodeJS Windows Services Controller
# Installation
___
Install the module
```
npm i nodejs-windows-service-controller
```

Include the module in your script:
```javascript
const ServiceController = require("nodejs-windows-service-controller");
```
&nbsp;
# Usage
___
Create a new instance of the service:
```javascript
const Superfetch = new ServiceController("Superfetch");
```

You can then use that instance for any of the following methods;
NOTE: All methods return a promise and any that return data will resolve with that data, and any that return no data will resolve when the operation is finished.

### ServiceController.changeStartupType(desiredStartupType)
```javscript
Superfetch.changeStartupType("Auto");
```
Changes the startup type of the service to the desiredStartupType which can be any of the following;
* Auto
* Boot
* Disabled
* Demand
* System

&nbsp;
### ServiceController.continue()
```javscript
Superfetch.continue();
```
Continues the service if it is paused
&nbsp;
### ServiceController.getInfo()
```javascript
Superfetch.getInfo();
```
Returns an object detailing the information surrounding the service with the below properties;
* #### <Bool> CanPauseAndContinue
  True if the service can be paused, otherwise false.

* #### <Bool> CanShutdown
  True if the service should be notified when the system is shutting down; otherwise, false.

* #### <Bool> CanStop
  True if the service can be stopped; otherwise, false.

* #### <String[]> DependentServices
  An array of the names of services which are dependent on this service.

* #### <String> DisplayName
  The friendly name of the service, which can be used to identify the service.

* #### <String> MachineName
  The name of the computer that is running the service.

* #### <String> ServiceName
  The name that identifies the service.

* #### <String[]> ServicesDependedOn
  An array of Services, each of which must be running for this service to run.

* #### <String> ServiceType
  The type of service that this object references.

* #### <String> StartType
  A value that indicates how the service starts.
  * Auto
  * Boot
  * Disabled
  * Demand
  * System

* #### <String> Status
  Indicates whether the service is running, stopped, or paused, or whether a start, stop, pause, or continue command is pending.

&nbsp;
### ServiceController.pause()
```javscript
Superfetch.pause(;
```
Pauses the service if it is running

&nbsp;
### ServiceController.start()
```javascript
Superfetch.start();
```
Starts the service if it is not already running


&nbsp;
### ServiceController.stop()
```javascript
Superfetch.stop();
```
Stops the service if it is running

&nbsp;
### ServiceController.waitForStatus(desiredStatus)
```javascript
Superfetch.waitForStatus("Running");
```
Returns a promise which resolves when the desired status that was passed to the method is reached. The desired status can be any of the following;
* ContinuePending
* Paused
* PausePending
* Running
* StartPending
* Stopped
* StopPending

---
_Source: https://npm.io/package/nodejs-windows-service-controller · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
