@firebase/storage 0.8.6-canary.3b338dbd8 → 0.8.6-canary.7a5bc84bd

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 (47) hide show
  1. package/dist/index.browser.cjs.js +215 -31
  2. package/dist/index.browser.cjs.js.map +1 -1
  3. package/dist/index.esm2017.js +194 -32
  4. package/dist/index.esm2017.js.map +1 -1
  5. package/dist/index.esm5.js +213 -32
  6. package/dist/index.esm5.js.map +1 -1
  7. package/dist/index.node.cjs.js +262 -51
  8. package/dist/index.node.cjs.js.map +1 -1
  9. package/dist/node-esm/index.node.esm.js +206 -52
  10. package/dist/node-esm/index.node.esm.js.map +1 -1
  11. package/dist/node-esm/src/api.browser.d.ts +32 -1
  12. package/dist/node-esm/src/api.d.ts +15 -0
  13. package/dist/node-esm/src/api.node.d.ts +32 -1
  14. package/dist/node-esm/src/implementation/connection.d.ts +14 -4
  15. package/dist/node-esm/src/implementation/request.d.ts +5 -5
  16. package/dist/node-esm/src/implementation/requestinfo.d.ts +14 -6
  17. package/dist/node-esm/src/implementation/requests.d.ts +17 -16
  18. package/dist/node-esm/src/platform/browser/connection.d.ts +24 -7
  19. package/dist/node-esm/src/platform/connection.d.ts +6 -2
  20. package/dist/node-esm/src/platform/node/connection.d.ts +30 -14
  21. package/dist/node-esm/src/reference.d.ts +13 -0
  22. package/dist/node-esm/src/service.d.ts +3 -3
  23. package/dist/node-esm/test/integration/integration.test.d.ts +4 -0
  24. package/dist/node-esm/test/{unit → node}/connection.test.d.ts +0 -0
  25. package/dist/{test/unit/connection.test.d.ts → node-esm/test/node/stream.test.d.ts} +0 -0
  26. package/dist/node-esm/test/unit/connection.d.ts +4 -3
  27. package/dist/node-esm/test/unit/testshared.d.ts +2 -2
  28. package/dist/src/api.browser.d.ts +32 -1
  29. package/dist/src/api.d.ts +15 -0
  30. package/dist/src/api.node.d.ts +32 -1
  31. package/dist/src/implementation/connection.d.ts +14 -4
  32. package/dist/src/implementation/request.d.ts +5 -5
  33. package/dist/src/implementation/requestinfo.d.ts +14 -6
  34. package/dist/src/implementation/requests.d.ts +17 -16
  35. package/dist/src/platform/browser/connection.d.ts +24 -7
  36. package/dist/src/platform/connection.d.ts +6 -2
  37. package/dist/src/platform/node/connection.d.ts +30 -14
  38. package/dist/src/reference.d.ts +13 -0
  39. package/dist/src/service.d.ts +3 -3
  40. package/dist/storage-public.d.ts +46 -0
  41. package/dist/storage.d.ts +80 -11
  42. package/dist/test/integration/integration.test.d.ts +4 -0
  43. package/dist/test/node/connection.test.d.ts +17 -0
  44. package/dist/test/node/stream.test.d.ts +17 -0
  45. package/dist/test/unit/connection.d.ts +4 -3
  46. package/dist/test/unit/testshared.d.ts +2 -2
  47. package/package.json +6 -6
@@ -336,7 +336,9 @@ callback, timeout) {
336
336
  // Would type this as "number" but that doesn't work for Node so ¯\_(ツ)_/¯
337
337
  // TODO: find a way to exclude Node type definition for storage because storage only works in browser
338
338
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
339
- let timeoutId = null;
339
+ let retryTimeoutId = null;
340
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
341
+ let globalTimeoutId = null;
340
342
  let hitTimeout = false;
341
343
  let cancelState = 0;
342
344
  function canceled() {
@@ -350,21 +352,29 @@ callback, timeout) {
350
352
  }
351
353
  }
352
354
  function callWithDelay(millis) {
353
- timeoutId = setTimeout(() => {
354
- timeoutId = null;
355
+ retryTimeoutId = setTimeout(() => {
356
+ retryTimeoutId = null;
355
357
  f(handler, canceled());
356
358
  }, millis);
357
359
  }
360
+ function clearGlobalTimeout() {
361
+ if (globalTimeoutId) {
362
+ clearTimeout(globalTimeoutId);
363
+ }
364
+ }
358
365
  function handler(success, ...args) {
359
366
  if (triggeredCallback) {
367
+ clearGlobalTimeout();
360
368
  return;
361
369
  }
362
370
  if (success) {
371
+ clearGlobalTimeout();
363
372
  triggerCallback.call(null, success, ...args);
364
373
  return;
365
374
  }
366
375
  const mustStop = canceled() || hitTimeout;
367
376
  if (mustStop) {
377
+ clearGlobalTimeout();
368
378
  triggerCallback.call(null, success, ...args);
369
379
  return;
370
380
  }
@@ -388,14 +398,15 @@ callback, timeout) {
388
398
  return;
389
399
  }
390
400
  stopped = true;
401
+ clearGlobalTimeout();
391
402
  if (triggeredCallback) {
392
403
  return;
393
404
  }
394
- if (timeoutId !== null) {
405
+ if (retryTimeoutId !== null) {
395
406
  if (!wasTimeout) {
396
407
  cancelState = 2;
397
408
  }
398
- clearTimeout(timeoutId);
409
+ clearTimeout(retryTimeoutId);
399
410
  callWithDelay(0);
400
411
  }
401
412
  else {
@@ -405,7 +416,7 @@ callback, timeout) {
405
416
  }
406
417
  }
407
418
  callWithDelay(0);
408
- setTimeout(() => {
419
+ globalTimeoutId = setTimeout(() => {
409
420
  hitTimeout = true;
410
421
  stop(true);
411
422
  }, timeout);
@@ -545,6 +556,14 @@ var ErrorCode;
545
556
  * See the License for the specific language governing permissions and
546
557
  * limitations under the License.
547
558
  */
559
+ /**
560
+ * Handles network logic for all Storage Requests, including error reporting and
561
+ * retries with backoff.
562
+ *
563
+ * @param I - the type of the backend's network response.
564
+ * @param - O the output type used by the rest of the SDK. The conversion
565
+ * happens in the specified `callback_`.
566
+ */
548
567
  class NetworkRequest {
549
568
  constructor(url_, method_, headers_, body_, successCodes_, additionalRetryCodes_, callback_, errorCallback_, timeout_, progressCallback_, connectionFactory_) {
550
569
  this.url_ = url_;
@@ -621,7 +640,7 @@ class NetworkRequest {
621
640
  const connection = status.connection;
622
641
  if (status.wasSuccessCode) {
623
642
  try {
624
- const result = this.callback_(connection, connection.getResponseText());
643
+ const result = this.callback_(connection, connection.getResponse());
625
644
  if (isJustDef(result)) {
626
645
  resolve(result);
627
646
  }
@@ -636,7 +655,7 @@ class NetworkRequest {
636
655
  else {
637
656
  if (connection !== null) {
638
657
  const err = unknown();
639
- err.serverResponse = connection.getResponseText();
658
+ err.serverResponse = connection.getErrorText();
640
659
  if (this.errorCallback_) {
641
660
  reject(this.errorCallback_(connection, err));
642
661
  }
@@ -767,7 +786,7 @@ function getBlobBuilder() {
767
786
  * @param args The values that will make up the resulting blob.
768
787
  * @return The blob.
769
788
  */
770
- function getBlob(...args) {
789
+ function getBlob$1(...args) {
771
790
  const BlobBuilder = getBlobBuilder();
772
791
  if (BlobBuilder !== undefined) {
773
792
  const bb = new BlobBuilder();
@@ -1117,7 +1136,7 @@ class FbsBlob {
1117
1136
  return val;
1118
1137
  }
1119
1138
  });
1120
- return new FbsBlob(getBlob.apply(null, blobby));
1139
+ return new FbsBlob(getBlob$1.apply(null, blobby));
1121
1140
  }
1122
1141
  else {
1123
1142
  const uint8Arrays = args.map((val) => {
@@ -1439,6 +1458,12 @@ function fromResponseString(service, bucket, resourceString) {
1439
1458
  return fromBackendResponse(service, bucket, resource);
1440
1459
  }
1441
1460
 
1461
+ /**
1462
+ * Contains a fully specified request.
1463
+ *
1464
+ * @param I - the type of the backend's network response.
1465
+ * @param O - the output response type used by the rest of the SDK.
1466
+ */
1442
1467
  class RequestInfo {
1443
1468
  constructor(url, method,
1444
1469
  /**
@@ -1522,7 +1547,7 @@ function sharedErrorHandler(location) {
1522
1547
  if (
1523
1548
  // This exact message string is the only consistent part of the
1524
1549
  // server's error response that identifies it as an App Check error.
1525
- xhr.getResponseText().includes('Firebase App Check token is invalid')) {
1550
+ xhr.getErrorText().includes('Firebase App Check token is invalid')) {
1526
1551
  newErr = unauthorizedApp();
1527
1552
  }
1528
1553
  else {
@@ -1594,6 +1619,19 @@ function list$2(service, location, delimiter, pageToken, maxResults) {
1594
1619
  requestInfo.errorHandler = sharedErrorHandler(location);
1595
1620
  return requestInfo;
1596
1621
  }
1622
+ function getBytes$1(service, location, maxDownloadSizeBytes) {
1623
+ const urlPart = location.fullServerUrl();
1624
+ const url = makeUrl(urlPart, service.host, service._protocol) + '?alt=media';
1625
+ const method = 'GET';
1626
+ const timeout = service.maxOperationRetryTime;
1627
+ const requestInfo = new RequestInfo(url, method, (_, data) => data, timeout);
1628
+ requestInfo.errorHandler = objectErrorHandler(location);
1629
+ if (maxDownloadSizeBytes !== undefined) {
1630
+ requestInfo.headers['Range'] = `bytes=0-${maxDownloadSizeBytes}`;
1631
+ requestInfo.successCodes = [200 /* OK */, 206 /* Partial Content */];
1632
+ }
1633
+ return requestInfo;
1634
+ }
1597
1635
  function getDownloadUrl(service, location, mappings) {
1598
1636
  const urlPart = location.fullServerUrl();
1599
1637
  const url = makeUrl(urlPart, service.host, service._protocol);
@@ -2000,7 +2038,7 @@ function async(f) {
2000
2038
  * limitations under the License.
2001
2039
  */
2002
2040
  /** An override for the text-based Connection. Used in tests. */
2003
- let connectionFactoryOverride = null;
2041
+ let textFactoryOverride = null;
2004
2042
  /**
2005
2043
  * Network layer for browsers. We use this instead of goog.net.XhrIo because
2006
2044
  * goog.net.XhrIo is hyuuuuge and doesn't work in React Native on Android.
@@ -2009,6 +2047,7 @@ class XhrConnection {
2009
2047
  constructor() {
2010
2048
  this.sent_ = false;
2011
2049
  this.xhr_ = new XMLHttpRequest();
2050
+ this.initXhr();
2012
2051
  this.errorCode_ = ErrorCode.NO_ERROR;
2013
2052
  this.sendPromise_ = new Promise(resolve => {
2014
2053
  this.xhr_.addEventListener('abort', () => {
@@ -2062,11 +2101,17 @@ class XhrConnection {
2062
2101
  return -1;
2063
2102
  }
2064
2103
  }
2065
- getResponseText() {
2104
+ getResponse() {
2105
+ if (!this.sent_) {
2106
+ throw internalError('cannot .getResponse() before sending');
2107
+ }
2108
+ return this.xhr_.response;
2109
+ }
2110
+ getErrorText() {
2066
2111
  if (!this.sent_) {
2067
- throw internalError('cannot .getResponseText() before sending');
2112
+ throw internalError('cannot .getErrorText() before sending');
2068
2113
  }
2069
- return this.xhr_.responseText;
2114
+ return this.xhr_.statusText;
2070
2115
  }
2071
2116
  /** Aborts the request. */
2072
2117
  abort() {
@@ -2086,10 +2131,29 @@ class XhrConnection {
2086
2131
  }
2087
2132
  }
2088
2133
  }
2089
- function newConnection() {
2090
- return connectionFactoryOverride
2091
- ? connectionFactoryOverride()
2092
- : new XhrConnection();
2134
+ class XhrTextConnection extends XhrConnection {
2135
+ initXhr() {
2136
+ this.xhr_.responseType = 'text';
2137
+ }
2138
+ }
2139
+ function newTextConnection() {
2140
+ return textFactoryOverride ? textFactoryOverride() : new XhrTextConnection();
2141
+ }
2142
+ class XhrBytesConnection extends XhrConnection {
2143
+ initXhr() {
2144
+ this.xhr_.responseType = 'arraybuffer';
2145
+ }
2146
+ }
2147
+ function newBytesConnection() {
2148
+ return new XhrBytesConnection();
2149
+ }
2150
+ class XhrBlobConnection extends XhrConnection {
2151
+ initXhr() {
2152
+ this.xhr_.responseType = 'blob';
2153
+ }
2154
+ }
2155
+ function newBlobConnection() {
2156
+ return new XhrBlobConnection();
2093
2157
  }
2094
2158
 
2095
2159
  /**
@@ -2231,7 +2295,7 @@ class UploadTask {
2231
2295
  _createResumable() {
2232
2296
  this._resolveToken((authToken, appCheckToken) => {
2233
2297
  const requestInfo = createResumableUpload(this._ref.storage, this._ref._location, this._mappings, this._blob, this._metadata);
2234
- const createRequest = this._ref.storage._makeRequest(requestInfo, newConnection, authToken, appCheckToken);
2298
+ const createRequest = this._ref.storage._makeRequest(requestInfo, newTextConnection, authToken, appCheckToken);
2235
2299
  this._request = createRequest;
2236
2300
  createRequest.getPromise().then((url) => {
2237
2301
  this._request = undefined;
@@ -2246,7 +2310,7 @@ class UploadTask {
2246
2310
  const url = this._uploadUrl;
2247
2311
  this._resolveToken((authToken, appCheckToken) => {
2248
2312
  const requestInfo = getResumableUploadStatus(this._ref.storage, this._ref._location, url, this._blob);
2249
- const statusRequest = this._ref.storage._makeRequest(requestInfo, newConnection, authToken, appCheckToken);
2313
+ const statusRequest = this._ref.storage._makeRequest(requestInfo, newTextConnection, authToken, appCheckToken);
2250
2314
  this._request = statusRequest;
2251
2315
  statusRequest.getPromise().then(status => {
2252
2316
  status = status;
@@ -2275,7 +2339,7 @@ class UploadTask {
2275
2339
  this._transition("error" /* ERROR */);
2276
2340
  return;
2277
2341
  }
2278
- const uploadRequest = this._ref.storage._makeRequest(requestInfo, newConnection, authToken, appCheckToken);
2342
+ const uploadRequest = this._ref.storage._makeRequest(requestInfo, newTextConnection, authToken, appCheckToken);
2279
2343
  this._request = uploadRequest;
2280
2344
  uploadRequest.getPromise().then((newStatus) => {
2281
2345
  this._increaseMultiplier();
@@ -2301,7 +2365,7 @@ class UploadTask {
2301
2365
  _fetchMetadata() {
2302
2366
  this._resolveToken((authToken, appCheckToken) => {
2303
2367
  const requestInfo = getMetadata$2(this._ref.storage, this._ref._location, this._mappings);
2304
- const metadataRequest = this._ref.storage._makeRequest(requestInfo, newConnection, authToken, appCheckToken);
2368
+ const metadataRequest = this._ref.storage._makeRequest(requestInfo, newTextConnection, authToken, appCheckToken);
2305
2369
  this._request = metadataRequest;
2306
2370
  metadataRequest.getPromise().then(metadata => {
2307
2371
  this._request = undefined;
@@ -2313,7 +2377,7 @@ class UploadTask {
2313
2377
  _oneShotUpload() {
2314
2378
  this._resolveToken((authToken, appCheckToken) => {
2315
2379
  const requestInfo = multipartUpload(this._ref.storage, this._ref._location, this._mappings, this._blob, this._metadata);
2316
- const multipartRequest = this._ref.storage._makeRequest(requestInfo, newConnection, authToken, appCheckToken);
2380
+ const multipartRequest = this._ref.storage._makeRequest(requestInfo, newTextConnection, authToken, appCheckToken);
2317
2381
  this._request = multipartRequest;
2318
2382
  multipartRequest.getPromise().then(metadata => {
2319
2383
  this._request = undefined;
@@ -2678,6 +2742,34 @@ class Reference {
2678
2742
  }
2679
2743
  }
2680
2744
  }
2745
+ /**
2746
+ * Download the bytes at the object's location.
2747
+ * @returns A Promise containing the downloaded bytes.
2748
+ */
2749
+ function getBytesInternal(ref, maxDownloadSizeBytes) {
2750
+ ref._throwIfRoot('getBytes');
2751
+ const requestInfo = getBytes$1(ref.storage, ref._location, maxDownloadSizeBytes);
2752
+ return ref.storage
2753
+ .makeRequestWithTokens(requestInfo, newBytesConnection)
2754
+ .then(bytes => maxDownloadSizeBytes !== undefined
2755
+ ? // GCS may not honor the Range header for small files
2756
+ bytes.slice(0, maxDownloadSizeBytes)
2757
+ : bytes);
2758
+ }
2759
+ /**
2760
+ * Download the bytes at the object's location.
2761
+ * @returns A Promise containing the downloaded blob.
2762
+ */
2763
+ function getBlobInternal(ref, maxDownloadSizeBytes) {
2764
+ ref._throwIfRoot('getBlob');
2765
+ const requestInfo = getBytes$1(ref.storage, ref._location, maxDownloadSizeBytes);
2766
+ return ref.storage
2767
+ .makeRequestWithTokens(requestInfo, newBlobConnection)
2768
+ .then(blob => maxDownloadSizeBytes !== undefined
2769
+ ? // GCS may not honor the Range header for small files
2770
+ blob.slice(0, maxDownloadSizeBytes)
2771
+ : blob);
2772
+ }
2681
2773
  /**
2682
2774
  * Uploads data to this object's location.
2683
2775
  * The upload is not resumable.
@@ -2691,7 +2783,7 @@ function uploadBytes$1(ref, data, metadata) {
2691
2783
  ref._throwIfRoot('uploadBytes');
2692
2784
  const requestInfo = multipartUpload(ref.storage, ref._location, getMappings(), new FbsBlob(data, true), metadata);
2693
2785
  return ref.storage
2694
- .makeRequestWithTokens(requestInfo, newConnection)
2786
+ .makeRequestWithTokens(requestInfo, newTextConnection)
2695
2787
  .then(finalMetadata => {
2696
2788
  return {
2697
2789
  metadata: finalMetadata,
@@ -2808,7 +2900,7 @@ function list$1(ref, options) {
2808
2900
  const op = options || {};
2809
2901
  const requestInfo = list$2(ref.storage, ref._location,
2810
2902
  /*delimiter= */ '/', op.pageToken, op.maxResults);
2811
- return ref.storage.makeRequestWithTokens(requestInfo, newConnection);
2903
+ return ref.storage.makeRequestWithTokens(requestInfo, newTextConnection);
2812
2904
  }
2813
2905
  /**
2814
2906
  * A `Promise` that resolves with the metadata for this object. If this
@@ -2820,7 +2912,7 @@ function list$1(ref, options) {
2820
2912
  function getMetadata$1(ref) {
2821
2913
  ref._throwIfRoot('getMetadata');
2822
2914
  const requestInfo = getMetadata$2(ref.storage, ref._location, getMappings());
2823
- return ref.storage.makeRequestWithTokens(requestInfo, newConnection);
2915
+ return ref.storage.makeRequestWithTokens(requestInfo, newTextConnection);
2824
2916
  }
2825
2917
  /**
2826
2918
  * Updates the metadata for this object.
@@ -2836,7 +2928,7 @@ function getMetadata$1(ref) {
2836
2928
  function updateMetadata$1(ref, metadata) {
2837
2929
  ref._throwIfRoot('updateMetadata');
2838
2930
  const requestInfo = updateMetadata$2(ref.storage, ref._location, metadata, getMappings());
2839
- return ref.storage.makeRequestWithTokens(requestInfo, newConnection);
2931
+ return ref.storage.makeRequestWithTokens(requestInfo, newTextConnection);
2840
2932
  }
2841
2933
  /**
2842
2934
  * Returns the download URL for the given Reference.
@@ -2848,7 +2940,7 @@ function getDownloadURL$1(ref) {
2848
2940
  ref._throwIfRoot('getDownloadURL');
2849
2941
  const requestInfo = getDownloadUrl(ref.storage, ref._location, getMappings());
2850
2942
  return ref.storage
2851
- .makeRequestWithTokens(requestInfo, newConnection)
2943
+ .makeRequestWithTokens(requestInfo, newTextConnection)
2852
2944
  .then(url => {
2853
2945
  if (url === null) {
2854
2946
  throw noDownloadURL();
@@ -2865,7 +2957,7 @@ function getDownloadURL$1(ref) {
2865
2957
  function deleteObject$1(ref) {
2866
2958
  ref._throwIfRoot('deleteObject');
2867
2959
  const requestInfo = deleteObject$2(ref.storage, ref._location);
2868
- return ref.storage.makeRequestWithTokens(requestInfo, newConnection);
2960
+ return ref.storage.makeRequestWithTokens(requestInfo, newTextConnection);
2869
2961
  }
2870
2962
  /**
2871
2963
  * Returns reference for object obtained by appending `childPath` to `ref`.
@@ -3122,7 +3214,7 @@ class FirebaseStorageImpl {
3122
3214
  }
3123
3215
 
3124
3216
  const name = "@firebase/storage";
3125
- const version = "0.8.6-canary.3b338dbd8";
3217
+ const version = "0.8.6-canary.7a5bc84bd";
3126
3218
 
3127
3219
  /**
3128
3220
  * @license
@@ -3161,6 +3253,24 @@ const STORAGE_TYPE = 'storage';
3161
3253
  * See the License for the specific language governing permissions and
3162
3254
  * limitations under the License.
3163
3255
  */
3256
+ /**
3257
+ * Downloads the data at the object's location. Returns an error if the object
3258
+ * is not found.
3259
+ *
3260
+ * To use this functionality, you have to whitelist your app's origin in your
3261
+ * Cloud Storage bucket. See also
3262
+ * https://cloud.google.com/storage/docs/configuring-cors
3263
+ *
3264
+ * @public
3265
+ * @param ref - StorageReference where data should be downloaded.
3266
+ * @param maxDownloadSizeBytes - If set, the maximum allowed size in bytes to
3267
+ * retrieve.
3268
+ * @returns A Promise containing the object's bytes
3269
+ */
3270
+ function getBytes(ref, maxDownloadSizeBytes) {
3271
+ ref = getModularInstance(ref);
3272
+ return getBytesInternal(ref, maxDownloadSizeBytes);
3273
+ }
3164
3274
  /**
3165
3275
  * Uploads data to this object's location.
3166
3276
  * The upload is not resumable.
@@ -3335,6 +3445,58 @@ function connectStorageEmulator(storage, host, port, options = {}) {
3335
3445
  connectStorageEmulator$1(storage, host, port, options);
3336
3446
  }
3337
3447
 
3448
+ /**
3449
+ * @license
3450
+ * Copyright 2021 Google LLC
3451
+ *
3452
+ * Licensed under the Apache License, Version 2.0 (the "License");
3453
+ * you may not use this file except in compliance with the License.
3454
+ * You may obtain a copy of the License at
3455
+ *
3456
+ * http://www.apache.org/licenses/LICENSE-2.0
3457
+ *
3458
+ * Unless required by applicable law or agreed to in writing, software
3459
+ * distributed under the License is distributed on an "AS IS" BASIS,
3460
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3461
+ * See the License for the specific language governing permissions and
3462
+ * limitations under the License.
3463
+ */
3464
+ /**
3465
+ * Downloads the data at the object's location. Returns an error if the object
3466
+ * is not found.
3467
+ *
3468
+ * To use this functionality, you have to whitelist your app's origin in your
3469
+ * Cloud Storage bucket. See also
3470
+ * https://cloud.google.com/storage/docs/configuring-cors
3471
+ *
3472
+ * This API is not available in Node.
3473
+ *
3474
+ * @public
3475
+ * @param ref - StorageReference where data should be downloaded.
3476
+ * @param maxDownloadSizeBytes - If set, the maximum allowed size in bytes to
3477
+ * retrieve.
3478
+ * @returns A Promise that resolves with a Blob containing the object's bytes
3479
+ */
3480
+ function getBlob(ref, maxDownloadSizeBytes) {
3481
+ ref = getModularInstance(ref);
3482
+ return getBlobInternal(ref, maxDownloadSizeBytes);
3483
+ }
3484
+ /**
3485
+ * Downloads the data at the object's location. Raises an error event if the
3486
+ * object is not found.
3487
+ *
3488
+ * This API is only available in Node.
3489
+ *
3490
+ * @public
3491
+ * @param ref - StorageReference where data should be downloaded.
3492
+ * @param maxDownloadSizeBytes - If set, the maximum allowed size in bytes to
3493
+ * retrieve.
3494
+ * @returns A stream with the object's data as bytes
3495
+ */
3496
+ function getStream(ref, maxDownloadSizeBytes) {
3497
+ throw new Error('getStream() is only supported by NodeJS builds');
3498
+ }
3499
+
3338
3500
  /**
3339
3501
  * Cloud Storage for Firebase
3340
3502
  *
@@ -3355,5 +3517,5 @@ function registerStorage() {
3355
3517
  }
3356
3518
  registerStorage();
3357
3519
 
3358
- export { StringFormat, FbsBlob as _FbsBlob, Location as _Location, TaskEvent as _TaskEvent, TaskState as _TaskState, UploadTask as _UploadTask, dataFromString as _dataFromString, _getChild, invalidArgument as _invalidArgument, invalidRootOperation as _invalidRootOperation, connectStorageEmulator, deleteObject, getDownloadURL, getMetadata, getStorage, list, listAll, ref, updateMetadata, uploadBytes, uploadBytesResumable, uploadString };
3520
+ export { StringFormat, FbsBlob as _FbsBlob, Location as _Location, TaskEvent as _TaskEvent, TaskState as _TaskState, UploadTask as _UploadTask, dataFromString as _dataFromString, _getChild, invalidArgument as _invalidArgument, invalidRootOperation as _invalidRootOperation, connectStorageEmulator, deleteObject, getBlob, getBytes, getDownloadURL, getMetadata, getStorage, getStream, list, listAll, ref, updateMetadata, uploadBytes, uploadBytesResumable, uploadString };
3359
3521
  //# sourceMappingURL=index.esm2017.js.map