Exports the createClient
This commit is contained in:
parent
cda8ff2e17
commit
564d8c3432
|
@ -1,7 +1,7 @@
|
|||
var storage = require('../lib/factory');
|
||||
var storage = require('../');
|
||||
var path = require('path');
|
||||
|
||||
var rs = storage.createClient({
|
||||
var rs = storage({
|
||||
provider: 'rackspace',
|
||||
username: 'strongloop',
|
||||
apiKey: 'your-rackspace-api-key'
|
||||
|
@ -39,7 +39,7 @@ rs.getContainers(function (err, containers) {
|
|||
*/
|
||||
|
||||
|
||||
var s3 = storage.createClient({
|
||||
var s3 = storage({
|
||||
provider: 'amazon',
|
||||
key: 'your-amazon-key',
|
||||
keyId: 'your-amazon-key-id'
|
||||
|
@ -60,7 +60,7 @@ s3.getContainers(function (err, containers) {
|
|||
});
|
||||
});
|
||||
|
||||
var fs = storage.createClient({
|
||||
var fs = storage({
|
||||
provider: 'filesystem',
|
||||
root: path.join(__dirname, 'storage')
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
exports.createClient = function (options) {
|
||||
function createClient(options) {
|
||||
options = options || {};
|
||||
var provider = options.provider || 'filesystem';
|
||||
|
||||
|
@ -14,4 +14,7 @@ exports.createClient = function (options) {
|
|||
|
||||
return new provider(options);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = createClient;
|
||||
module.exports.createClient = createClient;
|
|
@ -51,7 +51,7 @@ Uploader.prototype.processUpload = function (req, res, cb) {
|
|||
} else {
|
||||
values.push(value);
|
||||
}
|
||||
self.emit('field', part.name + '[' + (values.length -1) + ']', value);
|
||||
self.emit('field', part.name, value);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ Uploader.prototype.processUpload = function (req, res, cb) {
|
|||
} else {
|
||||
values.push(file);
|
||||
}
|
||||
self.emit('file', part.name + '[' + (values.length -1) + ']', file);
|
||||
self.emit('file', part.name, file);
|
||||
self._maybeEnd();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"name": "asteroid-storage-service",
|
||||
"description": "Asteroid Storage Service",
|
||||
"version": "0.0.1",
|
||||
"main": "lib/index.js",
|
||||
"main": "lib/factory.js",
|
||||
"scripts": {
|
||||
"test": "./node_modules/.bin/mocha --timeout 30000 test/*test.js"
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue