# spero

> file copy emitter middleware

Latest version **2.0.6** (published 2017-10-04) · MIT license · 0 weekly downloads

## Install

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

## 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 | 2.0.6 |
| Published | 2017-10-04 |
| First published | 2015-05-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | coderaiser |
| Maintainers | coderaiser |
| Keywords | file, copy, emitter, middleware |

## Links

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

## Dependencies (3)

- [mellow](https://npm.io/package/mellow.md) ~2.0.0
- [currify](https://npm.io/package/currify.md) ^2.0.4
- [copymitter](https://npm.io/package/copymitter.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

- 2.0.6 (latest) — 2017-10-04
- 2.0.5 — 2017-09-22
- 2.0.4 — 2017-07-11
- 2.0.3 — 2017-07-11
- 2.0.2 — 2017-07-07
- 2.0.1 — 2017-07-07
- 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 — 2016-11-08
- … 44 more at https://npm.io/package/spero/versions

## README

# Spero [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL]

File copy emitter middleware based on [socket.io](http://socket.io "Socket.io") and [copymitter](https://github.com/coderaiser/node-copymitter "Copymitter").

## Install

```
npm i spero --save
```

## Client

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

```js
const prefix = '/spero';

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

## Server

```js
const spero = require('spero');
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(spero({
    online: true,
    authCheck: function(socket, success) {
    }
});

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

## Environments

In old `node.js` environments that supports `es5` only, `dword` could be used with:

```js
var spero = require('spero/legacy');
```

## License

MIT

[NPMIMGURL]:                https://img.shields.io/npm/v/spero.svg?style=flat
[DependencyStatusIMGURL]:   https://img.shields.io/gemnasium/coderaiser/node-spero.svg?style=flat
[LicenseIMGURL]:            https://img.shields.io/badge/license-MIT-317BF9.svg?style=flat
[BuildStatusIMGURL]:        https://img.shields.io/travis/coderaiser/node-spero/master.svg?style=flat
[NPMURL]:                   https://npmjs.org/package/spero "npm"
[DependencyStatusURL]:      https://gemnasium.com/coderaiser/node-spero "Dependency Status"
[LicenseURL]:               https://tldrlegal.com/license/mit-license "MIT License"
[BuildStatusURL]:           https://travis-ci.org/coderaiser/node-spero  "Build Status"

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