# system-sleep

> A real and better system sleep() for Node. Works on every platform.

Latest version **1.3.8** (published 2025-04-14) · 0 weekly downloads

## Install

```sh
npm install system-sleep
pnpm add system-sleep
yarn add system-sleep
bun add system-sleep
```

## Health

**Score 28/100 (F)** — status: maintenance-mode.

Positive: has types package; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.8 |
| Published | 2025-04-14 |
| First published | 2015-10-29 |
| Weekly downloads | 0 |
| TypeScript types | separate (@types/system-sleep) |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 4.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 50 |
| Maintainers | jochemstoel |

## Links

- npm: https://www.npmjs.com/package/system-sleep
- Repository: https://github.com/jochemstoel/nodejs-system-sleep
- Issues: https://github.com/jochemstoel/nodejs-system-sleep/issues
- npm.io page: https://npm.io/package/system-sleep

## Dependencies (1)

- [deasync-promise](https://npm.io/package/deasync-promise.md) 1.0.1

## Recent versions

- 1.3.8 (latest) — 2025-04-14
- 1.3.7 — 2020-09-28
- 1.3.6 — 2017-09-10
- 1.3.5 — 2017-05-12
- 1.3.0 — 2017-02-15
- 1.2.0 — 2017-01-31
- 1.0.0-k — 2016-11-08
- 1.0.0-j — 2016-11-08
- 1.0.0-i — 2016-11-08
- 1.0.0-h — 2016-11-08
- 1.0.0-g — 2016-10-22
- 1.0.0-f — 2015-11-07
- 1.0.0-c — 2015-11-07
- 1.0.0-b — 2015-11-07
- 1.0.0-a — 2015-10-29
- … 1 more at https://npm.io/package/system-sleep/versions

## README

# Node.js Sleep()
for those who need Sleep() just like me.

![Sleeping Beauty](https://res.cloudinary.com/jochemstoel/image/upload/v1744663064/NPM/1744663021511-canvas.png)

*UPDATE: NO LONGER REQUIRES CHILD PROCESS, using deasync instead. It will fall back on self child process mode if deasync fails.*

```
 @package system-sleep
 @version 1.2
 @author Jochem Stoel (http://jochemstoel.github.io)
 @license don't involve me
 ```

* will make the system wait xxx milliseconds.
* can be used to delay script execution.
* is often used to relax the system in between resource intensive tasks.
* works on every platform x86 + x64 Windows / Linux / OSX



* Existing sleep() solutions use a blocking while loop which uses 100% CPU. This is incredibly stupid.
* Also, many sleep() solutions are only for Windows or only for Linux.

### Install using NPM
```bash
npm install system-sleep
```
### Use
```javascript
var sleep = require('system-sleep');
sleep(5000); // 5 seconds
```
### Test
Prints <i><a>variable y</a></i> to the console every 1 second during 10 seconds.
```javascript
var sleep = require('system-sleep');
for (y = 0; y < 10; y++) {
	console.log(y);
	sleep(1000);
}
```

<img alt="Jochem Stoel" src="http://33.media.tumblr.com/avatar_048a728a1488_128.png" style="float: left;">

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