Skip to content
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

exists method for storage/bucket#file ? #914

Closed
wong2 opened this issue Oct 17, 2015 · 7 comments
Closed

exists method for storage/bucket#file ? #914

wong2 opened this issue Oct 17, 2015 · 7 comments
Assignees
Labels

Comments

@wong2
Copy link

wong2 commented Oct 17, 2015

Currently I can't find a method to check if a file is already existed in the bucket.

@stephenplusplus
Copy link
Contributor

We don't have an exists method (yet/something like it/maybe) but this is what it would do:

file.getMetadata(function(err) {
  if (err.code === 404) {
    // doesn't exist
  }
});

@wong2
Copy link
Author

wong2 commented Oct 17, 2015

@stephenplusplus thanks! btw I think this should be added to the document or added as a method.

@jgeewax
Copy link
Contributor

jgeewax commented Oct 17, 2015 via email

@stephenplusplus
Copy link
Contributor

The last discussion (#862) ended up (#904) with:

  • File.create
  • File.get
  • File.getOrCreate

Do you want exists in addition to those?

@jgeewax
Copy link
Contributor

jgeewax commented Oct 17, 2015

I think exists is a super simple shortcut around get -- so yea, I'd be 👍 to adding it to the list.

@stephenplusplus
Copy link
Contributor

exists exists! It will be released this week across all of our APIs (except Datastore for now).

@wong2
Copy link
Author

wong2 commented Nov 18, 2015

great!

发送自 Outlook

On Tue, Nov 17, 2015 at 11:16 AM -0800, "Stephen Sawchuk" notifications@github.com wrote:

Closed #914.


Reply to this email directly or view it on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants