# remedy

> emitting middleware for file removing

Latest version **3.0.3** (published 2025-12-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install remedy
pnpm add remedy
yarn add remedy
bun add remedy
```

## Health

**Score 45/100 (D)** — status: stable.

Positive: no vulnerabilities.

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

## Facts

| | |
|---|---|
| Version | 3.0.3 |
| Published | 2025-12-01 |
| First published | 2015-06-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4 |
| Dependencies | 2 |
| Unpacked size | 12.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | cloudcmd |
| Maintainers | coderaiser |
| Keywords | file, remove, emitter, middleware |

## Links

- npm: https://www.npmjs.com/package/remedy
- Repository: https://github.com/cloudcmd/node-remedy
- Issues: https://github.com/cloudcmd/node-remedy/issues
- npm.io page: https://npm.io/package/remedy

## Dependencies (2)

- [remy](https://npm.io/package/remy.md) ^2.0.0
- [mellow](https://npm.io/package/mellow.md) ~2.0.0

## Alternatives

- [async-exit-hook](https://npm.io/package/async-exit-hook.md) — 3.7M weekly downloads
- [evnty](https://npm.io/package/evnty.md) — 7.2K weekly downloads
- [eleventy-plugin-asciidoc](https://npm.io/package/eleventy-plugin-asciidoc.md) — 3.5K weekly downloads
- [@jswork/next-get2get](https://npm.io/package/@jswork/next-get2get.md) — 945 weekly downloads
- [@dashersw/axon](https://npm.io/package/@dashersw/axon.md) — 934 weekly downloads

## Recent versions

- 3.0.3 (latest) — 2025-12-01
- 3.0.2 — 2017-10-04
- 3.0.1 — 2017-07-25
- 3.0.0 — 2017-07-14
- 2.0.0 — 2017-07-07
- 1.5.9 — 2017-05-17
- 1.5.8 — 2017-05-10
- 1.5.7 — 2017-04-28
- 1.5.6 — 2017-04-28
- 1.5.5 — 2017-04-28
- 1.5.4 — 2017-03-01
- 1.5.3 — 2017-02-01
- 1.5.2 — 2017-01-27
- 1.5.1 — 2016-10-26
- 1.5.0 — 2016-07-18
- … 26 more at https://npm.io/package/remedy/versions

## README

# Remedy

Emitting middleware for file removing based on [socket.io](http://socket.io "Socket.io") and [remy](https://github.com/coderaiser/node-remy "Remy").

## Install

```
npm i remedy --save
```

## Client

Could be loaded from url `/remedy/remedy.js`.

```js
/* could be one argument: callback */
remedy('/remedy', function(remover) {
    const from = '/';
    const to = '/tmp';
    const names = [
        'bin'
    ];
    const progress = (value) => {
        console.log('progress:', value);
    };
    
    const end = () => {
        console.log('end');
        remover.removeListener('progress', progress);
        remover.removeListener('end', end);
    };
    
    const error = (data) => {
        const msg = data + '\n Continue?';
        const is = confirm(msg);
        
        if (is)
            return remover.continue();
        
        remover.abort();
    };
    
    remover(from, names);
    
    remover.on('progress', progress);
    remover.on('end', end);
    remover.on('error', error);
});

```

## Server

```js
const remedy = require('remedy');
const http = require('http');
const express = require('express');
const io = require('socket.io');
const app = express();
const port = 1337;
const server = http.createServer(app);
const socket = io.listen(server);

server.listen(port);

app.use(remedy({
    online: true,
    authCheck: function(socket, success) {
    }
}));

remedy.listen(socket, {
    prefix: '/remedy',  /* default              */
    root: '/',          /* string or function   */
});
```

## License

MIT

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