Some refactoring
This commit is contained in:
parent
427f270a40
commit
82279ccacb
|
@ -1,4 +1,4 @@
|
|||
var storage = require('../lib/index');
|
||||
var storage = require('../lib/factory');
|
||||
var path = require('path');
|
||||
|
||||
var rs = storage.createClient({
|
||||
|
|
|
@ -4,7 +4,7 @@ var express = require('express');
|
|||
var app = express();
|
||||
|
||||
app.configure(function () {
|
||||
app.set('port', process.env.PORT || 3000);
|
||||
app.set('port', process.env.PORT || 3001);
|
||||
app.set('views', __dirname + '/views');
|
||||
app.set('view engine', 'ejs');
|
||||
app.use(express.favicon());
|
||||
|
|
|
@ -1,16 +1,25 @@
|
|||
var factory = require('./index');
|
||||
var factory = require('./factory');
|
||||
|
||||
var IncomingForm = require('formidable');
|
||||
var StringDecoder = require('string_decoder').StringDecoder;
|
||||
|
||||
module.exports = Uploader;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param options The client instance or options to create a client
|
||||
* @returns {Uploader}
|
||||
* @constructor
|
||||
*/
|
||||
function Uploader(options) {
|
||||
if (!(this instanceof Uploader)) {
|
||||
return new Uploader(options);
|
||||
}
|
||||
this.client = factory.createClient(options);
|
||||
this.options = options;
|
||||
if('function' === typeof options) {
|
||||
this.client = options;
|
||||
} else {
|
||||
this.client = factory.createClient(options);
|
||||
}
|
||||
}
|
||||
|
||||
Uploader.prototype.processUpload = function (req, res, cb) {
|
||||
|
|
Loading…
Reference in New Issue