# osx-mouse-stream

> Mouse events as a stream

Latest version **1.0.1** (published 2015-05-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install osx-mouse-stream
pnpm add osx-mouse-stream
yarn add osx-mouse-stream
bun add osx-mouse-stream
```

Provides the command `mouse-stream`.

## 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.0.1 |
| Published | 2015-05-09 |
| First published | 2015-05-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Maintainers | kapetan |
| Keywords | osx, mouse, track, events, position, stream |

## Links

- npm: https://www.npmjs.com/package/osx-mouse-stream
- Repository: https://github.com/kapetan/osx-mouse-stream
- Issues: https://github.com/kapetan/osx-mouse-stream/issues
- npm.io page: https://npm.io/package/osx-mouse-stream

## Dependencies (5)

- [once](https://npm.io/package/once.md) ^1.3.2
- [macmouse](https://npm.io/package/macmouse.md) ^1.0.0
- [minimist](https://npm.io/package/minimist.md) ^1.1.1
- [osx-mouse](https://npm.io/package/osx-mouse.md) ^1.0.2
- [JSONStream](https://npm.io/package/JSONStream.md) ^1.0.3

## Alternatives

- [@sentry/react-native](https://npm.io/package/@sentry/react-native.md) — 2.6M weekly downloads
- [@ardatan/aggregate-error](https://npm.io/package/@ardatan/aggregate-error.md) — 708.1K weekly downloads
- [custom-error-generator](https://npm.io/package/custom-error-generator.md) — 2.0K weekly downloads
- [@technik-sde/prosemirror-recreate-transform](https://npm.io/package/@technik-sde/prosemirror-recreate-transform.md) — 1.5K weekly downloads
- [@suchipi/error-utils](https://npm.io/package/@suchipi/error-utils.md) — 78 weekly downloads

## Recent versions

- 1.0.1 (latest) — 2015-05-09
- 1.0.0 — 2015-05-09

## README

# osx-mouse-stream

Streaming mouse events for OS X. Built using [osx-mouse](https://github.com/kapetan/osx-mouse) module.

	npm install osx-mouse-stream

# Usage

By default the module exposes a readable stream of mouse input events.

```javascript
var readableMouse = require('osx-mouse-stream');
var JSONStream = require('JSONStream');

readableMouse()
	.pipe(JSONStream.stringify(false))
	.pipe(process.stdout);
```

The above would output an object of the following format.

```javascript
{
	type: 'move',
	time: 1431187372523,
	x: 0,
	y: 0
}
```

The `osx-mouse` module provides a full list of available event types.

It's also possible to create a writable stream which accepts the described object format, and executes the mouse commands using the [macmouse](https://github.com/Loknar/node-macmouse) module.

```javascript
var writableMouse = require('osx-mouse-stream/writable');
var stream = writableMouse();

stream.write({
	type: 'move',
	time: 1431187372523,
	x: 0,
	y: 0
});
```

# Command-line

The command-line tool can be used to record and replay mouse events.

```
mouse-stream > log
```

Pipe the file back into the cli.

```
cat log | mouse-stream --no-output
```

The `--no-output` and `--no-input` options disable the readable and writable part of the cli.

With [airpaste](https://github.com/mafintosh/airpaste) it's possible to take control of the mouse on another OS X machine.

```
mouse-stream | airpaste
```

```
airpaste | mouse-stream --no-output
```

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