Skip to content

Commit

Permalink
Merge pull request #8 from VeliovGroup/dev_1
Browse files Browse the repository at this point in the history
- Minor enhancements
  • Loading branch information
dr-dimitru committed Apr 23, 2015
2 parents 17a2ab3 + d92142f commit c400f67
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .versions
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ [email protected]
[email protected]
[email protected]
[email protected]
ostrio:[email protected].3
ostrio:[email protected].4
ostrio:[email protected]
[email protected]
[email protected]
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ API
========
##### `new Meteor.Files([config])` [*Isomorphic*]

__config is optional object with next properties:__
__`config` is optional object with next properties:__
- `storagePath` **String** - Storage path on file system
* Default value: `/assets/app/uploads`
- `collectionName` **String** - Collection name
Expand Down Expand Up @@ -165,7 +165,7 @@ Template Helper
==========
To get download URL for file, you only need `fileRef` object, so there is no need for subscription
```jade
a(href="{{fileURL fileRef}}?download=true" target-"_parent" download) {{fileRef.name}}
a(href="{{fileURL fileRef}}?download=true" target="_parent" download) {{fileRef.name}}
```

Methods
Expand Down
14 changes: 4 additions & 10 deletions files.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,11 @@ class Meteor.Files
_methods = {}

_methods[self.methodNames.MeteorFileUnlink] = (inst) ->
console.info "Meteor.Files Debugger: [MeteorFileUnlink]" if @debug
console.info "Meteor.Files Debugger: [MeteorFileUnlink]" if self.debug
self.remove.call cp(_insts[inst._prefix], inst), inst.search

_methods[self.methodNames.MeteorFileWrite] = (unitArray, fileData, meta, first, chunksQty, currentChunk, totalSentChunks, randFileName, part, partsQty, fileSize) ->
console.info "Meteor.Files Debugger: [MeteorFileWrite]" if @debug
console.info "Meteor.Files Debugger: [MeteorFileWrite]" if self.debug
check unitArray, Match.OneOf Uint8Array, Object
check fileData, Object
check meta, Match.Optional Object
Expand Down Expand Up @@ -436,6 +436,7 @@ class Meteor.Files
check streams, Match.Optional Number

if file
console.time('insert') if @debug
self = @
result =
onPause: new ReactiveVar false
Expand Down Expand Up @@ -469,10 +470,7 @@ class Meteor.Files
ext: file.name.split('.').pop()
extension: file.name.split('.').pop()

file = _.extend file, fileData

console.time('insert') if @debug

file = _.extend file, fileData
randFileName = @namingFunction.call null, true
partSize = Math.ceil file.size / streams
parts = []
Expand All @@ -481,7 +479,6 @@ class Meteor.Files

window.onbeforeunload = (e) ->
message = if _.isFunction(self.onbeforeunloadMessage) then self.onbeforeunloadMessage.call(null) else self.onbeforeunloadMessage

if e
e.returnValue = message
return message
Expand All @@ -496,7 +493,6 @@ class Meteor.Files
chunksQty: if @chunkSize < partSize then Math.ceil(partSize / @chunkSize) else 1
i++


end = (error, data) ->
console.timeEnd('insert') if self.debug
window.onbeforeunload = null
Expand Down Expand Up @@ -525,7 +521,6 @@ class Meteor.Files
unitArray = new Uint8Array arrayBuffer.result
last = (part is streams and currentChunk >= chunksQtyInPart)


if chunksQtyInPart is 1
Meteor.call self.methodNames.MeteorFileWrite, unitArray, fileData, meta, first, chunksQtyInPart, currentChunk, totalSentChunks, randFileName, part, streams, file.size, (error, data) ->
if data.last
Expand Down Expand Up @@ -700,7 +695,6 @@ class Meteor.Files
link: (fileRef) ->
console.info "Meteor.Files Debugger: [link()]" if @debug
check @currentFile or fileRef, Object
console.log @currentFile, fileRef
return if fileRef then "#{fileRef._downloadRoute}/#{fileRef._collectionName}/#{fileRef._id}/#{fileRef._id}.#{fileRef.extension}" else "#{@currentFile._downloadRoute}/#{@currentFile._collectionName}/#{@currentFile._id}/#{@currentFile._id}.#{@currentFile.extension}"

if Meteor.isClient
Expand Down
2 changes: 1 addition & 1 deletion package.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package.describe({
name: 'ostrio:files',
version: '1.1.3',
version: '1.1.4',
summary: 'Upload, Store and Download small and huge files to/from file system (FS) via DDP and HTTP',
git: 'https://github.com/VeliovGroup/Meteor-Files',
documentation: 'README.md'
Expand Down

0 comments on commit c400f67

Please sign in to comment.