How to upload an image to IBM Cloud object storage (COS) using Node.js? - amazon-s3

I am using ibm-cos-sdk but I can able to store text files only, but I want to upload images and pdf files. Can someone help me out of that?

The IBM Cloud solution tutorial on how to apply end to end security to a cloud app features a file sharing app. The files are stored in COS, the app built using Node.js. See these lines of code for the example.
// upload to COS
await cos.upload({
Bucket: COS_BUCKET_NAME,
Key: `${fileDetails.userId}/${fileDetails.id}/${fileDetails.name}`,
Body: fs.createReadStream(file.path),
ContentType: fileDetails.type,
}).promise();
The snippet uses the mentioned ibm-cos-sdk with the S3 interface. I have used the app and code to upload images and PDFs.

Related

Splitting a pdf File after uploading in amplify app with s3 storage

I'm trying to create a webapp for uploading some files, I created an amplify app (react) with a storage hooked up, now I would like to work the files either before being uploaded or after, to split and retrieve only some pages,
I confess that I don't know where to start to get this result, could you advise me where to start without using lambda
I followed the amplify guides to build the app and storage, and I used this component to upload files:
https://ui.docs.amplify.aws/react/connected-components/storage/fileuploader
how can i get the result?
where should i start from?

Google cloud storage compatibility with aws s3 multipart upload

Okay, I have a working apps that use amazon s3 multipart, they use CreateMultipart, UploadPart and CompleteMultiPart.
Now we are migrating to google cloud storage and we have a problem with multipart. As far as I understood google doesn't support s3 multipart, got info from here Google Cloud Storage support of S3 multipart upload.
So I see that google has closest method Compose https://cloud.google.com/storage/docs/composite-objects, where I just upload different objects and then send request to combine them, or I can use uploadType=multipart https://cloud.google.com/storage/docs/json_api/v1/how-tos/upload#resumable, but this seems to be completely different from s3 multipart. And there is resumable upload https://cloud.google.com/storage/docs/resumable-uploads, that seems to allow upload files in chunks, but without complete multipart.
What is the best option to use? Some services already use CreateMultiPart, UploadPart, CompletePart and I need to write "adapter" for this services in order to make them compatible with google cloud storage.
Update: below answer is no longer correct. GCS does support multipart uploads: https://cloud.google.com/storage/docs/xml-api/post-object-multipart
You are correct. Google Cloud Storage does not currently support multipart upload.
The main benefits to multipart upload are allowing multiple streams to upload in parallel from one or more machines and allowing a partial upload failure not to ruin the whole upload. The best way to get those same benefits with GCS would be to upload the parts as separate objects and then using Compose to combine them into a final object. Indeed, this is exactly what the gsutil command-line utility does when uploading in parallel.
Resumable uploads are a great tool if you want to upload a single object in a single stream, in order, and you want the ability to resume if the connection is lost.
"uploadtype=multipart" uploads are a bit different. They are a way to specify an object's complete metadata and also its data in a single upload operation, using an HTTP multipart request.

Storing a remote hosted image on S3 directly using java sdk

I know I can download the image on server and then upload again to S3 or any other cloud hosting service, but is there any way to store the image asset directly on s3 by supplying URL of asset instead of a file, because I don't want to add unwanted download and upload on my server.
Note: I am assured that the URI will be 99.9% up and image file will also be there. And I am OK to use services other than S3 if they have such a feature.
No. There is no API call for Amazon S3 that will retrieve content from another location.
You must supply the content as part of the API call.

How can I pass a string representation of an image to Cloudinary upload?

Is it possible to get an image from a client application (Angular using ng-file-upload) and pass this into a webApi controller to then upload to Cloudinary?
Reading the docs it seems that the Cloudinary API expects to read the image directly from file/Amazon S3 bucket/internet location?
How can I pass the string representation of an image to cloudinary upload?
Cloudinary allows you to upload using a BASE64 URI representation as well. For more information see: https://support.cloudinary.com/hc/en-us/articles/203125741-Can-I-upload-using-DATA-URI-BASE64-
Direct upload can be established either based on the jQuery plugin or ng-file-upload plugin. Both are demonstrated in this sample project.

S3 SWF Uploader callbacks - RoR 3

I'm trying to get S3 SWF Uploader plugin working on my Heroku hosted RoR app.
At this point i have it installed, and i can upload files to my Amazon bucket... that's great!
But how can i get my hands on the callback functions? I simply can't find them!
Thanks
He has a list of all the Javascript callbacks in the README on GitHub: https://github.com/nathancolgate/s3-swf-upload-plugin
He also has a sample app which shows the code and how he's using the callbacks: http://s3swfuploader.heroku.com/
The one you'd be interested in is: :onUploadingFinish ()