@firebase/storage 0.8.7 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/index.browser.cjs.js +198 -25
  3. package/dist/index.browser.cjs.js.map +1 -1
  4. package/dist/index.esm2017.js +177 -26
  5. package/dist/index.esm2017.js.map +1 -1
  6. package/dist/index.esm5.js +196 -26
  7. package/dist/index.esm5.js.map +1 -1
  8. package/dist/index.node.cjs.js +245 -45
  9. package/dist/index.node.cjs.js.map +1 -1
  10. package/dist/node-esm/index.node.esm.js +189 -46
  11. package/dist/node-esm/index.node.esm.js.map +1 -1
  12. package/dist/node-esm/src/api.browser.d.ts +32 -1
  13. package/dist/node-esm/src/api.d.ts +15 -0
  14. package/dist/node-esm/src/api.node.d.ts +32 -1
  15. package/dist/node-esm/src/implementation/connection.d.ts +14 -4
  16. package/dist/node-esm/src/implementation/request.d.ts +5 -5
  17. package/dist/node-esm/src/implementation/requestinfo.d.ts +14 -6
  18. package/dist/node-esm/src/implementation/requests.d.ts +17 -16
  19. package/dist/node-esm/src/platform/browser/connection.d.ts +24 -7
  20. package/dist/node-esm/src/platform/connection.d.ts +6 -2
  21. package/dist/node-esm/src/platform/node/connection.d.ts +30 -14
  22. package/dist/node-esm/src/reference.d.ts +13 -0
  23. package/dist/node-esm/src/service.d.ts +3 -3
  24. package/dist/node-esm/test/integration/integration.test.d.ts +4 -0
  25. package/dist/node-esm/test/{unit → node}/connection.test.d.ts +0 -0
  26. package/dist/{test/unit/connection.test.d.ts → node-esm/test/node/stream.test.d.ts} +0 -0
  27. package/dist/node-esm/test/unit/connection.d.ts +4 -3
  28. package/dist/node-esm/test/unit/testshared.d.ts +2 -2
  29. package/dist/src/api.browser.d.ts +32 -1
  30. package/dist/src/api.d.ts +15 -0
  31. package/dist/src/api.node.d.ts +32 -1
  32. package/dist/src/implementation/connection.d.ts +14 -4
  33. package/dist/src/implementation/request.d.ts +5 -5
  34. package/dist/src/implementation/requestinfo.d.ts +14 -6
  35. package/dist/src/implementation/requests.d.ts +17 -16
  36. package/dist/src/platform/browser/connection.d.ts +24 -7
  37. package/dist/src/platform/connection.d.ts +6 -2
  38. package/dist/src/platform/node/connection.d.ts +30 -14
  39. package/dist/src/reference.d.ts +13 -0
  40. package/dist/src/service.d.ts +3 -3
  41. package/dist/storage-public.d.ts +46 -0
  42. package/dist/storage.d.ts +80 -11
  43. package/dist/test/integration/integration.test.d.ts +4 -0
  44. package/dist/test/node/connection.test.d.ts +17 -0
  45. package/dist/test/node/stream.test.d.ts +17 -0
  46. package/dist/test/unit/connection.d.ts +4 -3
  47. package/dist/test/unit/testshared.d.ts +2 -2
  48. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  #Unreleased
2
2
 
3
+ ## 0.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`e34e98e73`](https://github.com/firebase/firebase-js-sdk/commit/e34e98e73a72f77ee87d9005d6728402129deda9) [#5672](https://github.com/firebase/firebase-js-sdk/pull/5672) (fixes [#76](https://github.com/firebase/firebase-js-sdk/issues/76)) - Adds `getBytes()`, `getStream()` and `getBlob()`, which allow direct file downloads from the SDK.
8
+
9
+ ### Patch Changes
10
+
11
+ - [`0394cc97b`](https://github.com/firebase/firebase-js-sdk/commit/0394cc97b98f04dae87b718655eb46174275ebc2) [#5743](https://github.com/firebase/firebase-js-sdk/pull/5743) - Fix typings for storage and storage-compat.
12
+
3
13
  ## 0.8.7
4
14
 
5
15
  ### Patch Changes
@@ -587,6 +587,14 @@ var ErrorCode;
587
587
  * See the License for the specific language governing permissions and
588
588
  * limitations under the License.
589
589
  */
590
+ /**
591
+ * Handles network logic for all Storage Requests, including error reporting and
592
+ * retries with backoff.
593
+ *
594
+ * @param I - the type of the backend's network response.
595
+ * @param - O the output type used by the rest of the SDK. The conversion
596
+ * happens in the specified `callback_`.
597
+ */
590
598
  var NetworkRequest = /** @class */ (function () {
591
599
  function NetworkRequest(url_, method_, headers_, body_, successCodes_, additionalRetryCodes_, callback_, errorCallback_, timeout_, progressCallback_, connectionFactory_) {
592
600
  var _this = this;
@@ -665,7 +673,7 @@ var NetworkRequest = /** @class */ (function () {
665
673
  var connection = status.connection;
666
674
  if (status.wasSuccessCode) {
667
675
  try {
668
- var result = _this.callback_(connection, connection.getResponseText());
676
+ var result = _this.callback_(connection, connection.getResponse());
669
677
  if (isJustDef(result)) {
670
678
  resolve(result);
671
679
  }
@@ -680,7 +688,7 @@ var NetworkRequest = /** @class */ (function () {
680
688
  else {
681
689
  if (connection !== null) {
682
690
  var err = unknown();
683
- err.serverResponse = connection.getResponseText();
691
+ err.serverResponse = connection.getErrorText();
684
692
  if (_this.errorCallback_) {
685
693
  reject(_this.errorCallback_(connection, err));
686
694
  }
@@ -813,7 +821,7 @@ function getBlobBuilder() {
813
821
  * @param args The values that will make up the resulting blob.
814
822
  * @return The blob.
815
823
  */
816
- function getBlob() {
824
+ function getBlob$1() {
817
825
  var args = [];
818
826
  for (var _i = 0; _i < arguments.length; _i++) {
819
827
  args[_i] = arguments[_i];
@@ -1173,7 +1181,7 @@ var FbsBlob = /** @class */ (function () {
1173
1181
  return val;
1174
1182
  }
1175
1183
  });
1176
- return new FbsBlob(getBlob.apply(null, blobby));
1184
+ return new FbsBlob(getBlob$1.apply(null, blobby));
1177
1185
  }
1178
1186
  else {
1179
1187
  var uint8Arrays = args.map(function (val) {
@@ -1499,6 +1507,12 @@ function fromResponseString(service, bucket, resourceString) {
1499
1507
  return fromBackendResponse(service, bucket, resource);
1500
1508
  }
1501
1509
 
1510
+ /**
1511
+ * Contains a fully specified request.
1512
+ *
1513
+ * @param I - the type of the backend's network response.
1514
+ * @param O - the output response type used by the rest of the SDK.
1515
+ */
1502
1516
  var RequestInfo = /** @class */ (function () {
1503
1517
  function RequestInfo(url, method,
1504
1518
  /**
@@ -1583,7 +1597,7 @@ function sharedErrorHandler(location) {
1583
1597
  if (
1584
1598
  // This exact message string is the only consistent part of the
1585
1599
  // server's error response that identifies it as an App Check error.
1586
- xhr.getResponseText().includes('Firebase App Check token is invalid')) {
1600
+ xhr.getErrorText().includes('Firebase App Check token is invalid')) {
1587
1601
  newErr = unauthorizedApp();
1588
1602
  }
1589
1603
  else {
@@ -1655,6 +1669,19 @@ function list$2(service, location, delimiter, pageToken, maxResults) {
1655
1669
  requestInfo.errorHandler = sharedErrorHandler(location);
1656
1670
  return requestInfo;
1657
1671
  }
1672
+ function getBytes$1(service, location, maxDownloadSizeBytes) {
1673
+ var urlPart = location.fullServerUrl();
1674
+ var url = makeUrl(urlPart, service.host, service._protocol) + '?alt=media';
1675
+ var method = 'GET';
1676
+ var timeout = service.maxOperationRetryTime;
1677
+ var requestInfo = new RequestInfo(url, method, function (_, data) { return data; }, timeout);
1678
+ requestInfo.errorHandler = objectErrorHandler(location);
1679
+ if (maxDownloadSizeBytes !== undefined) {
1680
+ requestInfo.headers['Range'] = "bytes=0-" + maxDownloadSizeBytes;
1681
+ requestInfo.successCodes = [200 /* OK */, 206 /* Partial Content */];
1682
+ }
1683
+ return requestInfo;
1684
+ }
1658
1685
  function getDownloadUrl(service, location, mappings) {
1659
1686
  var urlPart = location.fullServerUrl();
1660
1687
  var url = makeUrl(urlPart, service.host, service._protocol);
@@ -2067,7 +2094,7 @@ function async(f) {
2067
2094
  * limitations under the License.
2068
2095
  */
2069
2096
  /** An override for the text-based Connection. Used in tests. */
2070
- var connectionFactoryOverride = null;
2097
+ var textFactoryOverride = null;
2071
2098
  /**
2072
2099
  * Network layer for browsers. We use this instead of goog.net.XhrIo because
2073
2100
  * goog.net.XhrIo is hyuuuuge and doesn't work in React Native on Android.
@@ -2077,6 +2104,7 @@ var XhrConnection = /** @class */ (function () {
2077
2104
  var _this = this;
2078
2105
  this.sent_ = false;
2079
2106
  this.xhr_ = new XMLHttpRequest();
2107
+ this.initXhr();
2080
2108
  this.errorCode_ = ErrorCode.NO_ERROR;
2081
2109
  this.sendPromise_ = new Promise(function (resolve) {
2082
2110
  _this.xhr_.addEventListener('abort', function () {
@@ -2130,11 +2158,17 @@ var XhrConnection = /** @class */ (function () {
2130
2158
  return -1;
2131
2159
  }
2132
2160
  };
2133
- XhrConnection.prototype.getResponseText = function () {
2161
+ XhrConnection.prototype.getResponse = function () {
2134
2162
  if (!this.sent_) {
2135
- throw internalError('cannot .getResponseText() before sending');
2163
+ throw internalError('cannot .getResponse() before sending');
2136
2164
  }
2137
- return this.xhr_.responseText;
2165
+ return this.xhr_.response;
2166
+ };
2167
+ XhrConnection.prototype.getErrorText = function () {
2168
+ if (!this.sent_) {
2169
+ throw internalError('cannot .getErrorText() before sending');
2170
+ }
2171
+ return this.xhr_.statusText;
2138
2172
  };
2139
2173
  /** Aborts the request. */
2140
2174
  XhrConnection.prototype.abort = function () {
@@ -2155,10 +2189,44 @@ var XhrConnection = /** @class */ (function () {
2155
2189
  };
2156
2190
  return XhrConnection;
2157
2191
  }());
2158
- function newConnection() {
2159
- return connectionFactoryOverride
2160
- ? connectionFactoryOverride()
2161
- : new XhrConnection();
2192
+ var XhrTextConnection = /** @class */ (function (_super) {
2193
+ tslib.__extends(XhrTextConnection, _super);
2194
+ function XhrTextConnection() {
2195
+ return _super !== null && _super.apply(this, arguments) || this;
2196
+ }
2197
+ XhrTextConnection.prototype.initXhr = function () {
2198
+ this.xhr_.responseType = 'text';
2199
+ };
2200
+ return XhrTextConnection;
2201
+ }(XhrConnection));
2202
+ function newTextConnection() {
2203
+ return textFactoryOverride ? textFactoryOverride() : new XhrTextConnection();
2204
+ }
2205
+ var XhrBytesConnection = /** @class */ (function (_super) {
2206
+ tslib.__extends(XhrBytesConnection, _super);
2207
+ function XhrBytesConnection() {
2208
+ return _super !== null && _super.apply(this, arguments) || this;
2209
+ }
2210
+ XhrBytesConnection.prototype.initXhr = function () {
2211
+ this.xhr_.responseType = 'arraybuffer';
2212
+ };
2213
+ return XhrBytesConnection;
2214
+ }(XhrConnection));
2215
+ function newBytesConnection() {
2216
+ return new XhrBytesConnection();
2217
+ }
2218
+ var XhrBlobConnection = /** @class */ (function (_super) {
2219
+ tslib.__extends(XhrBlobConnection, _super);
2220
+ function XhrBlobConnection() {
2221
+ return _super !== null && _super.apply(this, arguments) || this;
2222
+ }
2223
+ XhrBlobConnection.prototype.initXhr = function () {
2224
+ this.xhr_.responseType = 'blob';
2225
+ };
2226
+ return XhrBlobConnection;
2227
+ }(XhrConnection));
2228
+ function newBlobConnection() {
2229
+ return new XhrBlobConnection();
2162
2230
  }
2163
2231
 
2164
2232
  /**
@@ -2306,7 +2374,7 @@ var UploadTask = /** @class */ (function () {
2306
2374
  var _this = this;
2307
2375
  this._resolveToken(function (authToken, appCheckToken) {
2308
2376
  var requestInfo = createResumableUpload(_this._ref.storage, _this._ref._location, _this._mappings, _this._blob, _this._metadata);
2309
- var createRequest = _this._ref.storage._makeRequest(requestInfo, newConnection, authToken, appCheckToken);
2377
+ var createRequest = _this._ref.storage._makeRequest(requestInfo, newTextConnection, authToken, appCheckToken);
2310
2378
  _this._request = createRequest;
2311
2379
  createRequest.getPromise().then(function (url) {
2312
2380
  _this._request = undefined;
@@ -2322,7 +2390,7 @@ var UploadTask = /** @class */ (function () {
2322
2390
  var url = this._uploadUrl;
2323
2391
  this._resolveToken(function (authToken, appCheckToken) {
2324
2392
  var requestInfo = getResumableUploadStatus(_this._ref.storage, _this._ref._location, url, _this._blob);
2325
- var statusRequest = _this._ref.storage._makeRequest(requestInfo, newConnection, authToken, appCheckToken);
2393
+ var statusRequest = _this._ref.storage._makeRequest(requestInfo, newTextConnection, authToken, appCheckToken);
2326
2394
  _this._request = statusRequest;
2327
2395
  statusRequest.getPromise().then(function (status) {
2328
2396
  status = status;
@@ -2352,7 +2420,7 @@ var UploadTask = /** @class */ (function () {
2352
2420
  _this._transition("error" /* ERROR */);
2353
2421
  return;
2354
2422
  }
2355
- var uploadRequest = _this._ref.storage._makeRequest(requestInfo, newConnection, authToken, appCheckToken);
2423
+ var uploadRequest = _this._ref.storage._makeRequest(requestInfo, newTextConnection, authToken, appCheckToken);
2356
2424
  _this._request = uploadRequest;
2357
2425
  uploadRequest.getPromise().then(function (newStatus) {
2358
2426
  _this._increaseMultiplier();
@@ -2379,7 +2447,7 @@ var UploadTask = /** @class */ (function () {
2379
2447
  var _this = this;
2380
2448
  this._resolveToken(function (authToken, appCheckToken) {
2381
2449
  var requestInfo = getMetadata$2(_this._ref.storage, _this._ref._location, _this._mappings);
2382
- var metadataRequest = _this._ref.storage._makeRequest(requestInfo, newConnection, authToken, appCheckToken);
2450
+ var metadataRequest = _this._ref.storage._makeRequest(requestInfo, newTextConnection, authToken, appCheckToken);
2383
2451
  _this._request = metadataRequest;
2384
2452
  metadataRequest.getPromise().then(function (metadata) {
2385
2453
  _this._request = undefined;
@@ -2392,7 +2460,7 @@ var UploadTask = /** @class */ (function () {
2392
2460
  var _this = this;
2393
2461
  this._resolveToken(function (authToken, appCheckToken) {
2394
2462
  var requestInfo = multipartUpload(_this._ref.storage, _this._ref._location, _this._mappings, _this._blob, _this._metadata);
2395
- var multipartRequest = _this._ref.storage._makeRequest(requestInfo, newConnection, authToken, appCheckToken);
2463
+ var multipartRequest = _this._ref.storage._makeRequest(requestInfo, newTextConnection, authToken, appCheckToken);
2396
2464
  _this._request = multipartRequest;
2397
2465
  multipartRequest.getPromise().then(function (metadata) {
2398
2466
  _this._request = undefined;
@@ -2789,6 +2857,38 @@ var Reference = /** @class */ (function () {
2789
2857
  };
2790
2858
  return Reference;
2791
2859
  }());
2860
+ /**
2861
+ * Download the bytes at the object's location.
2862
+ * @returns A Promise containing the downloaded bytes.
2863
+ */
2864
+ function getBytesInternal(ref, maxDownloadSizeBytes) {
2865
+ ref._throwIfRoot('getBytes');
2866
+ var requestInfo = getBytes$1(ref.storage, ref._location, maxDownloadSizeBytes);
2867
+ return ref.storage
2868
+ .makeRequestWithTokens(requestInfo, newBytesConnection)
2869
+ .then(function (bytes) {
2870
+ return maxDownloadSizeBytes !== undefined
2871
+ ? // GCS may not honor the Range header for small files
2872
+ bytes.slice(0, maxDownloadSizeBytes)
2873
+ : bytes;
2874
+ });
2875
+ }
2876
+ /**
2877
+ * Download the bytes at the object's location.
2878
+ * @returns A Promise containing the downloaded blob.
2879
+ */
2880
+ function getBlobInternal(ref, maxDownloadSizeBytes) {
2881
+ ref._throwIfRoot('getBlob');
2882
+ var requestInfo = getBytes$1(ref.storage, ref._location, maxDownloadSizeBytes);
2883
+ return ref.storage
2884
+ .makeRequestWithTokens(requestInfo, newBlobConnection)
2885
+ .then(function (blob) {
2886
+ return maxDownloadSizeBytes !== undefined
2887
+ ? // GCS may not honor the Range header for small files
2888
+ blob.slice(0, maxDownloadSizeBytes)
2889
+ : blob;
2890
+ });
2891
+ }
2792
2892
  /**
2793
2893
  * Uploads data to this object's location.
2794
2894
  * The upload is not resumable.
@@ -2802,7 +2902,7 @@ function uploadBytes$1(ref, data, metadata) {
2802
2902
  ref._throwIfRoot('uploadBytes');
2803
2903
  var requestInfo = multipartUpload(ref.storage, ref._location, getMappings(), new FbsBlob(data, true), metadata);
2804
2904
  return ref.storage
2805
- .makeRequestWithTokens(requestInfo, newConnection)
2905
+ .makeRequestWithTokens(requestInfo, newTextConnection)
2806
2906
  .then(function (finalMetadata) {
2807
2907
  return {
2808
2908
  metadata: finalMetadata,
@@ -2934,7 +3034,7 @@ function list$1(ref, options) {
2934
3034
  var op = options || {};
2935
3035
  var requestInfo = list$2(ref.storage, ref._location,
2936
3036
  /*delimiter= */ '/', op.pageToken, op.maxResults);
2937
- return ref.storage.makeRequestWithTokens(requestInfo, newConnection);
3037
+ return ref.storage.makeRequestWithTokens(requestInfo, newTextConnection);
2938
3038
  }
2939
3039
  /**
2940
3040
  * A `Promise` that resolves with the metadata for this object. If this
@@ -2946,7 +3046,7 @@ function list$1(ref, options) {
2946
3046
  function getMetadata$1(ref) {
2947
3047
  ref._throwIfRoot('getMetadata');
2948
3048
  var requestInfo = getMetadata$2(ref.storage, ref._location, getMappings());
2949
- return ref.storage.makeRequestWithTokens(requestInfo, newConnection);
3049
+ return ref.storage.makeRequestWithTokens(requestInfo, newTextConnection);
2950
3050
  }
2951
3051
  /**
2952
3052
  * Updates the metadata for this object.
@@ -2962,7 +3062,7 @@ function getMetadata$1(ref) {
2962
3062
  function updateMetadata$1(ref, metadata) {
2963
3063
  ref._throwIfRoot('updateMetadata');
2964
3064
  var requestInfo = updateMetadata$2(ref.storage, ref._location, metadata, getMappings());
2965
- return ref.storage.makeRequestWithTokens(requestInfo, newConnection);
3065
+ return ref.storage.makeRequestWithTokens(requestInfo, newTextConnection);
2966
3066
  }
2967
3067
  /**
2968
3068
  * Returns the download URL for the given Reference.
@@ -2974,7 +3074,7 @@ function getDownloadURL$1(ref) {
2974
3074
  ref._throwIfRoot('getDownloadURL');
2975
3075
  var requestInfo = getDownloadUrl(ref.storage, ref._location, getMappings());
2976
3076
  return ref.storage
2977
- .makeRequestWithTokens(requestInfo, newConnection)
3077
+ .makeRequestWithTokens(requestInfo, newTextConnection)
2978
3078
  .then(function (url) {
2979
3079
  if (url === null) {
2980
3080
  throw noDownloadURL();
@@ -2991,7 +3091,7 @@ function getDownloadURL$1(ref) {
2991
3091
  function deleteObject$1(ref) {
2992
3092
  ref._throwIfRoot('deleteObject');
2993
3093
  var requestInfo = deleteObject$2(ref.storage, ref._location);
2994
- return ref.storage.makeRequestWithTokens(requestInfo, newConnection);
3094
+ return ref.storage.makeRequestWithTokens(requestInfo, newTextConnection);
2995
3095
  }
2996
3096
  /**
2997
3097
  * Returns reference for object obtained by appending `childPath` to `ref`.
@@ -3291,7 +3391,7 @@ var FirebaseStorageImpl = /** @class */ (function () {
3291
3391
  }());
3292
3392
 
3293
3393
  var name = "@firebase/storage";
3294
- var version = "0.8.7";
3394
+ var version = "0.9.0";
3295
3395
 
3296
3396
  /**
3297
3397
  * @license
@@ -3330,6 +3430,24 @@ var STORAGE_TYPE = 'storage';
3330
3430
  * See the License for the specific language governing permissions and
3331
3431
  * limitations under the License.
3332
3432
  */
3433
+ /**
3434
+ * Downloads the data at the object's location. Returns an error if the object
3435
+ * is not found.
3436
+ *
3437
+ * To use this functionality, you have to whitelist your app's origin in your
3438
+ * Cloud Storage bucket. See also
3439
+ * https://cloud.google.com/storage/docs/configuring-cors
3440
+ *
3441
+ * @public
3442
+ * @param ref - StorageReference where data should be downloaded.
3443
+ * @param maxDownloadSizeBytes - If set, the maximum allowed size in bytes to
3444
+ * retrieve.
3445
+ * @returns A Promise containing the object's bytes
3446
+ */
3447
+ function getBytes(ref, maxDownloadSizeBytes) {
3448
+ ref = util.getModularInstance(ref);
3449
+ return getBytesInternal(ref, maxDownloadSizeBytes);
3450
+ }
3333
3451
  /**
3334
3452
  * Uploads data to this object's location.
3335
3453
  * The upload is not resumable.
@@ -3506,6 +3624,58 @@ function connectStorageEmulator(storage, host, port, options) {
3506
3624
  connectStorageEmulator$1(storage, host, port, options);
3507
3625
  }
3508
3626
 
3627
+ /**
3628
+ * @license
3629
+ * Copyright 2021 Google LLC
3630
+ *
3631
+ * Licensed under the Apache License, Version 2.0 (the "License");
3632
+ * you may not use this file except in compliance with the License.
3633
+ * You may obtain a copy of the License at
3634
+ *
3635
+ * http://www.apache.org/licenses/LICENSE-2.0
3636
+ *
3637
+ * Unless required by applicable law or agreed to in writing, software
3638
+ * distributed under the License is distributed on an "AS IS" BASIS,
3639
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3640
+ * See the License for the specific language governing permissions and
3641
+ * limitations under the License.
3642
+ */
3643
+ /**
3644
+ * Downloads the data at the object's location. Returns an error if the object
3645
+ * is not found.
3646
+ *
3647
+ * To use this functionality, you have to whitelist your app's origin in your
3648
+ * Cloud Storage bucket. See also
3649
+ * https://cloud.google.com/storage/docs/configuring-cors
3650
+ *
3651
+ * This API is not available in Node.
3652
+ *
3653
+ * @public
3654
+ * @param ref - StorageReference where data should be downloaded.
3655
+ * @param maxDownloadSizeBytes - If set, the maximum allowed size in bytes to
3656
+ * retrieve.
3657
+ * @returns A Promise that resolves with a Blob containing the object's bytes
3658
+ */
3659
+ function getBlob(ref, maxDownloadSizeBytes) {
3660
+ ref = util.getModularInstance(ref);
3661
+ return getBlobInternal(ref, maxDownloadSizeBytes);
3662
+ }
3663
+ /**
3664
+ * Downloads the data at the object's location. Raises an error event if the
3665
+ * object is not found.
3666
+ *
3667
+ * This API is only available in Node.
3668
+ *
3669
+ * @public
3670
+ * @param ref - StorageReference where data should be downloaded.
3671
+ * @param maxDownloadSizeBytes - If set, the maximum allowed size in bytes to
3672
+ * retrieve.
3673
+ * @returns A stream with the object's data as bytes
3674
+ */
3675
+ function getStream(ref, maxDownloadSizeBytes) {
3676
+ throw new Error('getStream() is only supported by NodeJS builds');
3677
+ }
3678
+
3509
3679
  /**
3510
3680
  * Cloud Storage for Firebase
3511
3681
  *
@@ -3539,9 +3709,12 @@ exports._invalidArgument = invalidArgument;
3539
3709
  exports._invalidRootOperation = invalidRootOperation;
3540
3710
  exports.connectStorageEmulator = connectStorageEmulator;
3541
3711
  exports.deleteObject = deleteObject;
3712
+ exports.getBlob = getBlob;
3713
+ exports.getBytes = getBytes;
3542
3714
  exports.getDownloadURL = getDownloadURL;
3543
3715
  exports.getMetadata = getMetadata;
3544
3716
  exports.getStorage = getStorage;
3717
+ exports.getStream = getStream;
3545
3718
  exports.list = list;
3546
3719
  exports.listAll = listAll;
3547
3720
  exports.ref = ref;