-
Notifications
You must be signed in to change notification settings - Fork 368
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
No resumable option for getSignedUrl? #20
Comments
From @stephenplusplus on April 22, 2017 1:24 createResumableUpload initiates a reusable upload. Our 'upload' and 'createWriteStream' methods do the re-trying automatically. If you want to handle that behavior yourself, or outside of our client, you'd use 'createResumableUpload' to get a session URI. These are the specifications our implementation adheres to: https://cloud.google.com/storage/docs/json_api/v1/how-tos/resumable-upload |
From @odigity on April 22, 2017 1:50 I was under the impression that the Node lib is only appropriate to use in the context of:
Rather than in the browser for an anonymous (from GCS's perspective) user. Are you suggesting I import the @google-cloud/storage package in my React app and use the createResumableUpload method with a signed URL? |
From @stephenplusplus on April 22, 2017 1:56 Your context assumptions are correct, but you're free to experiment in using it in others. We don't have any prescribed recipes for how to integrate with "x", but StackOverflow is a good place to tap into the community around it. In general, if you have users accessing from a browser, you would likely ping a backend to make the necessary requests to the Storage API, as opposed to doing it all through the browser. If you do end up posting on SO, please link back so other users with the same interest can follow along. And of course, discussion can continue here with questions related to our library. |
From @odigity on April 22, 2017 8:50 Are you saying the absence of being able to use the Node.js lib to generate a signed URL for a resumable download (despite this feature existing on The end result is that I'm going to have to make my app server shell out to call |
From @odigity on April 23, 2017 23:3 After several hours of working through the problem, it seems to me that you could extend (Until that happens, I literally have to write and maintain my own version of |
From @stephenplusplus on April 24, 2017 14:41 Okay, thanks for finding a solution. Would you mind sending a PR? If we accepted a |
From @odigity on April 22, 2017 1:11
I've spent the last week learning about GCS, the SDK, and the Node client library, and just today finally get a prototype working that generated a signed URL on the server and passed it to the browser which used it to PUT a file.
Now I want to tackle resumable uploads for large files, and to my shock, I don't see a way to use the Node lib to make one. I even went into the code of both
gsutil
and the Node lib to confirm.gsutil
If you look at the docs for gsutil, it mentions that the
-m
option takes both the 'GET' and 'RESUMABLE' values (not a very complete list, should probably list all possible values), and later on shows an example with 'PUT', so at least those three are specified.If you check the code, you'll see that RESUMABLE gets converted to POST, and an
x-goog-resumable
header is used. Also here you'll see that all values are rejected except[ 'GET', 'PUT', 'DELETE', 'HEAD', 'RESUMABLE' ]
.Node.js Library
Now take a look at the docs for getSignedUrl in the Node lib. The action option takes three values ('read', 'write', 'delete') which it says are equivalent to 'GET', 'PUT', and 'DELETE' respectively. (Not sure why these special read/write/delete values are invented for the Node lib, it just adds confusion.)
Then in the code you can see that no other values are allowed.
So, the question is: How do I use the Node lib to generate a signed URL for a resumable upload?
Copied from original issue: googleapis/google-cloud-node#2248
The text was updated successfully, but these errors were encountered: