Meteor-Community-Packages / Meteor-CollectionFS

Reactive file manager for Meteor
MIT License
1.05k stars 237 forks source link

Readme Request: More info on insert with buffer etc. #420

Open yogiben opened 10 years ago

yogiben commented 10 years ago

I can't get insert to work on the server with an http url or the buffer (provided by s3).

Attachments.insert {data: data.Body,type:data.ContentType}

where data.Body is <Buffer 00 00 00 20 66 74 79 70 69 73 6f 6d 00 00...

and data.ContentType is video/mp4

gives error: DataMan constructor received data that it doesn't support

Is it possible to see an working example of this?

aldeed commented 10 years ago

Something like:

var newFile = new FS.File();
newFile.attachData(data.Body, {type: data.ContentType});
Attachments.insert(newFile);
raix commented 10 years ago

I guess we take pr's on docs too :)

yogiben commented 10 years ago

Thanks for the help. I ran into some separate fibers errors with the aws-sdk package I'm using.

What I'm really trying to do is insert a file based on an S3 object. I convert a video from .mov to .mp4 and detect when the conversion is finished and the file is in my bucket.

Any idea how to insert an existing S3 object into a FS.Collection?

It's probably possible to download it, then re-upload it, but maybe there's a better way. When I change the details of an existing FS.Collection doc (e.g. the key) I get an error about setting the headers.

aldeed commented 10 years ago

There is no easy way at the moment.

yogiben commented 10 years ago

Thanks for your feedback.

raix commented 10 years ago

Its part of sync mechanism its not implemented. I guess you could use the bare storage adapter, but we lack the list files function - should prop have it at some point.

yogiben commented 10 years ago

I was doing just that. I first tried to insert a new file with the buffer, but got a fibers error from the aws-sdk package.

Next I tried generating a signed url and inserting the file from that. Got errors on both client and server.

Will let you know if I figure it out.