@@ -883,6 +883,28 @@ class File extends ServiceObject<File> {
883883 this . instancePreconditionOpts = options ?. preconditionOpts ;
884884 }
885885
886+ /**
887+ * The object's Cloud Storage URI (`gs://`)
888+ *
889+ * @example
890+ * ```ts
891+ * const {Storage} = require('@google-cloud/storage');
892+ * const storage = new Storage();
893+ * const bucket = storage.bucket('my-bucket');
894+ * const file = bucket.file('image.png');
895+ *
896+ * // `gs://my-bucket/image.png`
897+ * const href = file.cloudStorageURI.href;
898+ * ```
899+ */
900+ get cloudStorageURI ( ) : URL {
901+ const uri = this . bucket . cloudStorageURI ;
902+
903+ uri . pathname = this . name ;
904+
905+ return uri ;
906+ }
907+
886908 /**
887909 * A helper method for determining if a request should be retried based on preconditions.
888910 * This should only be used for methods where the idempotency is determined by
@@ -2415,7 +2437,7 @@ class File extends ServiceObject<File> {
24152437 * @param {boolean } [config.virtualHostedStyle=false] Use virtual hosted-style
24162438 * URLs ('https://mybucket.storage.googleapis.com/...') instead of path-style
24172439 * ('https://storage.googleapis.com/mybucket/...'). Virtual hosted-style URLs
2418- * should generally be preferred instaed of path-style URL.
2440+ * should generally be preferred instead of path-style URL.
24192441 * Currently defaults to `false` for path-style, although this may change in a
24202442 * future major-version release.
24212443 * @param {string } [config.bucketBoundHostname] The bucket-bound hostname to return in
@@ -3855,6 +3877,7 @@ class File extends ServiceObject<File> {
38553877 */
38563878promisifyAll ( File , {
38573879 exclude : [
3880+ 'cloudStorageURI' ,
38583881 'publicUrl' ,
38593882 'request' ,
38603883 'save' ,
0 commit comments