Created
January 29, 2015 23:12
-
-
Save sergical/02969aea2e64dbf8c326 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
filepicker.pickAndStore( | |
{ | |
multiple: false, | |
maxFiles: 1, | |
services: ['COMPUTER', 'GOOGLE_DRIVE', 'DROPBOX'] | |
},{ | |
access:"private" | |
}, | |
function(InkBlobs){ | |
var fileTotal = 0; | |
_.each(InkBlobs, function (el) { | |
fileTotal += el.size; | |
Session.set('fileTotal', fileTotal); | |
el.size = bytesToSize(el.size); | |
var fullName = el.filename; | |
el.mimetype = fullName; | |
el.filename = longFileName(el.filename); | |
}); | |
Session.set('files', InkBlobs); | |
}, | |
function(FPError){ | |
if(FPError && FPError.code !== 101) | |
showError(FPError.toString()); | |
} | |
); |
@dylansimpson thanks for that. Sorry it took so long, had to focus on implementing other stuff.
So from my understanding, I have to modify this
function(InkBlobs){
var fileTotal = 0;
_.each(InkBlobs, function (el) {
fileTotal += el.size;
Session.set('fileTotal', fileTotal);
el.size = bytesToSize(el.size);
var fullName = el.filename;
el.mimetype = fullName;
el.filename = longFileName(el.filename);
});
Session.set('files', InkBlobs);
},
to
function(InkBlobs){
var fileTotal = 0;
_.each(InkBlobs, function (el) {
fileTotal += el.size;
Session.set('fileTotal', fileTotal);
el.size = bytesToSize(el.size);
var fullName = el.filename;
el.mimetype = fullName;
el.filename = longFileName(el.filename);
});
// zipping it up
var zip = new JSZip();
zip.file(InkBlobs);
Session.set('files', zip);
},
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Once filepicker returns the array of Blobs, pass them to JSZIP to combine then pass the combined zip back to filepicker.pickAndStore()
Here are the filepicker docs:
https://developers.filepicker.io/docs/web/javascript_api/#pickMultiple
JSZip has a good example of how to bundle them up:
https://stuk.github.io/jszip/documentation/examples/downloader.html