Skip to content

Commit 9a0587b

Browse files
committedOct 12, 2016
Minor enhancements and fixes
1 parent 4e41cb6 commit 9a0587b

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed
 

‎files.coffee

+8-7
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,7 @@ fixJSONStringify = (obj) ->
426426
@class FilesCollection
427427
@param config {Object} - [Both] Configuration object with next properties:
428428
@param config.debug {Boolean} - [Both] Turn on/of debugging and extra logging
429+
@param config.ddp {Object} - [Client] Custom DDP connection. Object returned form `DDP.connect()`
429430
@param config.schema {Object} - [Both] Collection Schema
430431
@param config.public {Boolean} - [Both] Store files in folder accessible for proxy servers, for limits, and more - read docs
431432
@param config.strict {Boolean} - [Server] Strict mode for partial content, if is `true` server will return `416` response code, when `range` is not specified, otherwise server return `206`
@@ -1443,7 +1444,7 @@ class FilesCollection
14431444
###
14441445
findOne: (selector, options) ->
14451446
console.info "[FilesCollection] [findOne(#{JSON.stringify(selector)}, #{JSON.stringify(options)})]" if @debug
1446-
check selector, Match.Optional Match.OneOf Object, String, Boolean, null
1447+
check selector, Match.Optional Match.OneOf Object, String, Boolean, Number, null
14471448
check options, Match.Optional Object
14481449

14491450
selector = {} unless arguments.length
@@ -1461,7 +1462,7 @@ class FilesCollection
14611462
###
14621463
find: (selector, options) ->
14631464
console.info "[FilesCollection] [find(#{JSON.stringify(selector)}, #{JSON.stringify(options)})]" if @debug
1464-
check selector, Match.Optional Match.OneOf Object, String, Boolean, null
1465+
check selector, Match.Optional Match.OneOf Object, String, Boolean, Number, null
14651466
check options, Match.Optional Object
14661467

14671468
selector = {} unless arguments.length
@@ -1479,7 +1480,7 @@ class FilesCollection
14791480
{Number|dynamic} streams - Quantity of parallel upload streams, default: 2
14801481
{Number|dynamic} chunkSize - Chunk size for upload
14811482
{String} transport - Upload transport `http` or `ddp`
1482-
{DDP} ddp - Custom DDP connection
1483+
{Object} ddp - Custom DDP connection. Object returned form `DDP.connect()`
14831484
{Function} onUploaded - Callback triggered when upload is finished, with two arguments `error` and `fileRef`
14841485
{Function} onStart - Callback triggered when upload is started after all successful validations, with two arguments `error` (always null) and `fileRef`
14851486
{Function} onError - Callback triggered on error in upload and/or FileReader, with two arguments `error` and `fileData`
@@ -1488,7 +1489,7 @@ class FilesCollection
14881489
return true to continue
14891490
return false to abort upload
14901491
@param {Boolean} autoStart - Start upload immediately. If set to false, you need manually call .start() method on returned class. Useful to set EventListeners.
1491-
@summary Upload file to server over DDP
1492+
@summary Upload file to server over DDP or HTTP
14921493
@returns {UploadInstance} Instance. UploadInstance has next properties:
14931494
{ReactiveVar} onPause - Is upload process on the pause?
14941495
{ReactiveVar} state - active|paused|aborted|completed
@@ -1516,7 +1517,7 @@ class FilesCollection
15161517
EventEmitter.call @
15171518
console.info '[FilesCollection] [insert()]' if @collection.debug
15181519
self = @
1519-
@config.ddp = @collection.ddp
1520+
@config.ddp ?= @collection.ddp
15201521
@config.meta ?= {}
15211522
@config.streams ?= 2
15221523
@config.streams = 2 if @config.streams < 1
@@ -1540,8 +1541,8 @@ class FilesCollection
15401541
onUploaded: Match.Optional Function
15411542
onProgress: Match.Optional Function
15421543
onBeforeUpload: Match.Optional Function
1543-
allowWebWorkers: Boolean,
1544-
ddp: Match.Any,
1544+
allowWebWorkers: Boolean
1545+
ddp: Match.Any
15451546
}
15461547

15471548
if not @config.fileName and not @config.file.name

0 commit comments

Comments
 (0)