Skip to content

exists method for storage/bucket#file ? #914

Description

@wong2

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

Activity

  1. stephenplusplus commented on Oct 17, 2015

    @stephenplusplus
    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
      }
    });
  2. wong2 commented on Oct 17, 2015

    @wong2
    Author

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

  3. jgeewax commented on Oct 17, 2015

    @jgeewax
    Contributor
  4. stephenplusplus commented on Oct 17, 2015

    @stephenplusplus
    Contributor

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

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

    Do you want exists in addition to those?

  5. jgeewax commented on Oct 17, 2015

    @jgeewax
    Contributor

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

  6. stephenplusplus commented on Nov 17, 2015

    @stephenplusplus
    Contributor

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

  7. wong2 commented on Nov 18, 2015

    @wong2
    Author

    great!

    发送自 Outlook

    On Tue, Nov 17, 2015 at 11:16 AM -0800, "Stephen Sawchuk" [email protected] wrote:

    Closed #914.

    —
    Reply to this email directly or view it on GitHub.

  8. 7 remaining items

  9. added a commit that references this issue on Feb 25, 2026
  10. added a commit that references this issue on Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions