https://github.com/artskydj/sox-server
:satellite: A server that runs sox to convert audio files to a specified type
https://github.com/artskydj/sox-server
Last synced: 9 months ago
JSON representation
:satellite: A server that runs sox to convert audio files to a specified type
- Host: GitHub
- URL: https://github.com/artskydj/sox-server
- Owner: ArtskydJ
- Created: 2015-10-15T12:30:45.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2019-03-29T03:49:57.000Z (about 7 years ago)
- Last Synced: 2025-03-12T05:29:50.573Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 14.6 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
I'm never going to work on this, so I added the `wontfix` label to the issues, and closed them.
-----------
sox-server
==========
[](https://travis-ci.org/ArtskydJ/sox-server)
# example
*server.js*
```js
var casa = require('sox-server')
var http = require('http')
var ecstatic = require('ecstatic')
var server = http.createServer(ecstatic(__dirname))
casa(server)
server.listen(8080)
```
*client.js*
```js
var upload = require('sox-server')
var dragDrop = require('drag-drop')
dragDrop('body', function (files) {
upload(files, function (err, responses) {
if (err) throw err
console.log(responses)
})
})
```
# server api
```js
var server = require('sox-server')()
```
### `server`
- `server` is an [`http.Server`](https://nodejs.org/api/http.html#http_class_http_server) instance. You have to call `server.listen(port)`.
# browser api
Written for use with [browserify](https://github.com/substack/node-browserify).
```js
var upload = require('sox-server')()
```
### `upload(files)`
`upload` is a function, as well as an event emitter.
- `files` is a file or an array of files.
### events
- `error(err)` - Emits an error that it got when trying to upload
- `ready(file)` - Emits the successfully converted `file`, or the same `file` if it was valid
```js
upload.on('error', console.error.bind(console))
upload.on('ready', function (file) {
console.log('yeah, converted another file!')
})
```
# install
With [npm](http://nodejs.org/download) do:
npm install sox-server
# license
[VOL](http://veryopenlicense.com)