summaryrefslogtreecommitdiff
path: root/app/node_modules
diff options
context:
space:
mode:
Diffstat (limited to 'app/node_modules')
-rw-r--r--app/node_modules/okservices/oks3/index.js27
1 files changed, 24 insertions, 3 deletions
diff --git a/app/node_modules/okservices/oks3/index.js b/app/node_modules/okservices/oks3/index.js
index dc0ca19..97abef0 100644
--- a/app/node_modules/okservices/oks3/index.js
+++ b/app/node_modules/okservices/oks3/index.js
@@ -14,6 +14,20 @@ function OKS3(options) {
throw new Error('Express not provided to OKS3');
if (!options.s3)
throw new Error('S3 configuration not provided to OKS3');
+
+ if (!options.s3.image) options.s3.image = {}
+ if (!options.s3.audio) options.s3.audio = {}
+ if (!options.s3.video) options.s3.video = {}
+
+ if (options.s3.maxbytes) {
+ if (! ('maxbytes' in options.s3.image))
+ options.s3.image.maxbytes = options.s3.maxbytes
+ if (! ('maxbytes' in options.s3.video))
+ options.s3.video.maxbytes = options.s3.maxbytes
+ if (! ('maxbytes' in options.s3.audio))
+ options.s3.audio.maxbytes = options.s3.maxbytes
+ }
+
var express = options.express;
var router = express.Router();
@@ -30,7 +44,8 @@ function OKS3(options) {
secret: options.s3.secret,
bucket: options.s3.bucket,
dirname: options.s3.dirname,
- maxBytes: options.s3.maxbytes,
+ maxBytes: options.s3.image.maxbytes,
+ saveAs: options.s3.image.preserveFilename && preserveFilename,
headers: {
'x-amz-acl': 'public-read'
}
@@ -52,7 +67,8 @@ function OKS3(options) {
secret: options.s3.secret,
bucket: options.s3.bucket,
dirname: options.s3.dirname,
- maxBytes: options.s3.maxbytesAudio,
+ maxBytes: options.s3.audio.maxbytes,
+ saveAs: options.s3.audio.preserveFilename && preserveFilename,
headers: {
'x-amz-acl': 'public-read'
}
@@ -74,7 +90,8 @@ function OKS3(options) {
secret: options.s3.secret,
bucket: options.s3.bucket,
dirname: options.s3.dirname,
- maxBytes: options.s3.maxbytesVideo,
+ maxBytes: options.s3.video.maxbytes,
+ saveAs: options.s3.video.preserveFilename && preserveFilename,
headers: {
'x-amz-acl': 'public-read'
}
@@ -84,6 +101,10 @@ function OKS3(options) {
});
});
});
+
+ function preserveFilename (stream, cb){
+ cb(null, stream.filename)
+ }
this._middleware = router;
}