Michael
Michael

Reputation: 187

Is it possible to upload to S3 via URL somehow? (Meteor.js)

I know that Amazon doesn't provide a pull service for S3, but is it possible to read an image on the server side and then upload it to S3?

Upvotes: 1

Views: 331

Answers (2)

Florian
Florian

Reputation: 1281

I have not used it myself but the most advanced file upload solution for Meteor looks to be collectionFS. It has client/server side components, template helpers and uses collections and security in a similar fashion as you normally use them with Meteor.

They have several storage adapters, where one of them can be used to store files in S3: https://github.com/CollectionFS/Meteor-cfs-s3

Upvotes: 0

Hubert OG
Hubert OG

Reputation: 19544

The simplest way is to use the aws-sdk Node package. It's pretty well documented here. For uploading images you use the putObject method.

Example:

S3.putObject({
  Bucket: bucketName,
  ACL: 'private',
  Key: fileName,
  ContentType: fileMimeType,
  Body: new Buffer(fileContents, 'binary'),
}, function(err, data) {
  ...
});

Upvotes: 2

Related Questions