-
-
Notifications
You must be signed in to change notification settings - Fork 169
Load
dr.dimitru edited this page Apr 8, 2016
·
10 revisions
Write file to FS from remote URL and add record to Files collection
-
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
-
-
callback
{Function} - Triggered after first byte is received. Witherror
, andfileRef
, wherefileRef
is a new record from DB - Returns {Files} - Current Meteor.Files instance
this.Images = new Meteor.Files({collectionName: 'Images'});
Images.load('https://raw.githubusercontent.com/VeliovGroup/Meteor-Files/master/logo.png', {
fileName: 'logo.png',
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 |