-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Delete files off S3 #50
Comments
Hey, this is currently not within the scope of the package. I would recommend using knox or similar to send delete request from the meteor server (not the client browser). |
Ok. Thanks! With this package do you have access to Knox server side? |
No, but there are plenty of packages available for knox. It doens't have to be knox either there is also aws-sdk. The reason Slingshot doesn't provide any of that, is because it is supposed to be lightweight. Organizing and deleting files from the bucket is not something that should be handled by slingshot directives. |
Thanks again. Love the package! Talk with you later. -Chris |
I need this feature as well. Any recommendations for a Meteor package that is lightweight enough for use with the sole purpose of deleting files? Maybe a delete-only version of slingshot? |
You can try this: Meteor.methods({
deleteFile: function (key) {
//TODO Check if authorization etc...
HTTP.call("DELETE", Slingshot.S3Storage.bucketUrl("mybucket", region) + "/" + key, {
headers: {
authorization: Slingshot.S3Storage.signAwsV4(canonicalRequest, AWSSecretAccessKey, date, region, "s3")
}
});
});
}); So you need I believe future future versions of slingshot will have a canonicalRequest method that you can use as it will be needed for #5. http:https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html |
@gsuess How do you get |
@gsuess For anyone looking to delete off Amazon S3, see my code snippet below. (On a server method): AWS.config.update({
accessKeyId: Meteor.settings.private.amazonS3.AWSAccessKeyId,
secretAccessKey: Meteor.settings.private.amazonS3.AWSSecretAccessKey
});
var s3 = new AWS.S3();
var params = {
Bucket: Meteor.settings.private.amazonS3.bucket,
Key: data.Key
};
var deleteObject = Meteor.wrapAsync(
s3.deleteObject(params, function(error, data) {
if(error) {
console.log(error);
} else {
console.log(data);
}
})
); Thanks again, |
Hello @centinel3, what would be the |
Hum, now I did!! |
Yes, the key is the path to the blob object. Glad you figured it out! |
Has anyone done this with Google Cloud Storage? |
@centinel3 can you please post a sample call from client? |
Feature request:
Are there any plans to allow the user to delete/remove files off amazon S3 storage?
Thanks and will talk with you soon. -Chris
The text was updated successfully, but these errors were encountered: