-
-
Notifications
You must be signed in to change notification settings - Fork 169
Load
dr.dimitru edited this page Mar 16, 2017
·
10 revisions
Write file to FS from remote URL (external resource) and add record to FilesCollection
-
url
{String} - Full address to file, likescheme://example.com/sample.png
-
opts
{Object} - Recommended properties:-
opts.fileName
{String} - File name with extension, likename.ext
-
opts.meta
{Object} - Object with custom meta-data -
opts.type
{String} - Mime-type, likeimage/png
, if not set - mime-type will be taken from response headers -
opts.size
{Number} - File size in bytes, if not set - file size will be taken from response headers -
opts.userId
{String} - UserId, default null -
opts.fileId
{String} - id, optional - if not set - Random.id() will be used
-
-
callback
{Function} - Triggered after first byte is received. Witherror
, andfileRef
, wherefileRef
is a new record from DB - proceedAfterUpload {Boolean} - Proceed
onAfterUpload
hook (if defined) after external source is loaded to FS - Returns {FilesCollection} - Current FilesCollection instance
var Images = new FilesCollection({collectionName: 'Images'});
Images.load('https://raw.githubusercontent.com/VeliovGroup/Meteor-Files/master/logo.png', {
fileName: 'logo.png',
fielId: 'abc123myId', //optional
meta: {}
});
Meteor-Files | Support | Try ostr.io |
---|---|---|
If you found this package useful, — star it at GitHub and support our open source contributions with a monthly pledge, or submit a one-time donation via PayPal | Monitoring, Analytics, WebSec, Web-CRON and Pre-rendering for a website |