# daemonize-process

> Daemonize the current Node.js process

Latest version **4.1.4** (published 2026-09-26) · BSD-2-Clause license · 0 weekly downloads

## Install

```sh
npm install daemonize-process
pnpm add daemonize-process
yarn add daemonize-process
bun add daemonize-process
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 4.1.4 |
| Published | 2026-09-26 |
| First published | 2018-01-05 |
| Weekly downloads | 0 |
| License | BSD-2-Clause |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18 |
| Dependencies | 0 |
| Unpacked size | 5.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 34 |
| Author | silverwind <me@silverwind.io> |
| Maintainers | silverwind |

## Links

- npm: https://www.npmjs.com/package/daemonize-process
- Repository: https://github.com/silverwind/daemonize-process
- npm.io page: https://npm.io/package/daemonize-process

## Recent versions

- 4.1.4 (latest) — 2026-09-26
- 4.1.3 — 2026-09-25
- 4.1.1 — 2025-02-14
- 4.1.0 — 2024-05-23
- 4.0.0 — 2023-09-14
- 3.0.0 — 2020-03-15
- 2.0.1 — 2019-01-22
- 2.0.0 — 2018-10-16
- 1.0.9 — 2018-02-07
- 1.0.8 — 2018-02-07
- 1.0.7 — 2018-01-23
- 1.0.6 — 2018-01-15
- 1.0.5 — 2018-01-06
- 1.0.4 — 2018-01-05
- 1.0.3 — 2018-01-05
- … 3 more at https://npm.io/package/daemonize-process/versions

## README

# daemonize-process
[![](https://img.shields.io/npm/v/daemonize-process.svg?style=flat)](https://www.npmjs.org/package/daemonize-process) [![](https://img.shields.io/npm/dm/daemonize-process.svg)](https://www.npmjs.org/package/daemonize-process) [![](https://packagephobia.com/badge?p=daemonize-process)](https://packagephobia.com/result?p=daemonize-process)

> Daemonize the current Node.js process

The module re-spawns the current process and then exits, which will lead to the new child process being adopted by `init` or similar mechanisms, effectively putting the current process into the background.

Differences to the `daemon` module include:

- Exposes all options of `child_process.spawn`.
- Cleans up `process.env` after itself.

## Usage

```sh
pnpm add daemonize-process
```

```js
import {daemonizeProcess} from "daemonize-process";

daemonizeProcess();

// below here the process is daemonized
```

## API

### daemonizeProcess([options])

The `options` object can contain any valid [`child_process.spawn` option](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options) as well as these properties:

- `script` *string* - The path to the script to be executed. Default: The current script.
- `arguments` *Array* - The command line arguments to be used. Default: The current arguments.
- `node` *string* - The path to the Node.js binary to be used. Default: The current Node.js binary.
- `exitCode` *number* - The exit code to be used when exiting the parent process. Default: `0`.

By default the standard streams of the child are ignored (e.g. attached to `/dev/null` or equivalent). If you need these streams, adjust the `stdio` option.

© [silverwind](https://github.com/silverwind), distributed under BSD licence

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