Open yogiben opened 10 years ago
Something like:
var newFile = new FS.File();
newFile.attachData(data.Body, {type: data.ContentType});
Attachments.insert(newFile);
I guess we take pr's on docs too :)
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.
There is no easy way at the moment.
Thanks for your feedback.
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.
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.
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
isvideo/mp4
gives error:
DataMan constructor received data that it doesn't support
Is it possible to see an working example of this?