@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.
- package/CHANGELOG.md +10 -0
- package/dist/index.browser.cjs.js +198 -25
- package/dist/index.browser.cjs.js.map +1 -1
- package/dist/index.esm2017.js +177 -26
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +196 -26
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +245 -45
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/node-esm/index.node.esm.js +189 -46
- package/dist/node-esm/index.node.esm.js.map +1 -1
- package/dist/node-esm/src/api.browser.d.ts +32 -1
- package/dist/node-esm/src/api.d.ts +15 -0
- package/dist/node-esm/src/api.node.d.ts +32 -1
- package/dist/node-esm/src/implementation/connection.d.ts +14 -4
- package/dist/node-esm/src/implementation/request.d.ts +5 -5
- package/dist/node-esm/src/implementation/requestinfo.d.ts +14 -6
- package/dist/node-esm/src/implementation/requests.d.ts +17 -16
- package/dist/node-esm/src/platform/browser/connection.d.ts +24 -7
- package/dist/node-esm/src/platform/connection.d.ts +6 -2
- package/dist/node-esm/src/platform/node/connection.d.ts +30 -14
- package/dist/node-esm/src/reference.d.ts +13 -0
- package/dist/node-esm/src/service.d.ts +3 -3
- package/dist/node-esm/test/integration/integration.test.d.ts +4 -0
- package/dist/node-esm/test/{unit → node}/connection.test.d.ts +0 -0
- package/dist/{test/unit/connection.test.d.ts → node-esm/test/node/stream.test.d.ts} +0 -0
- package/dist/node-esm/test/unit/connection.d.ts +4 -3
- package/dist/node-esm/test/unit/testshared.d.ts +2 -2
- package/dist/src/api.browser.d.ts +32 -1
- package/dist/src/api.d.ts +15 -0
- package/dist/src/api.node.d.ts +32 -1
- package/dist/src/implementation/connection.d.ts +14 -4
- package/dist/src/implementation/request.d.ts +5 -5
- package/dist/src/implementation/requestinfo.d.ts +14 -6
- package/dist/src/implementation/requests.d.ts +17 -16
- package/dist/src/platform/browser/connection.d.ts +24 -7
- package/dist/src/platform/connection.d.ts +6 -2
- package/dist/src/platform/node/connection.d.ts +30 -14
- package/dist/src/reference.d.ts +13 -0
- package/dist/src/service.d.ts +3 -3
- package/dist/storage-public.d.ts +46 -0
- package/dist/storage.d.ts +80 -11
- package/dist/test/integration/integration.test.d.ts +4 -0
- package/dist/test/node/connection.test.d.ts +17 -0
- package/dist/test/node/stream.test.d.ts +17 -0
- package/dist/test/unit/connection.d.ts +4 -3
- package/dist/test/unit/testshared.d.ts +2 -2
- package/package.json +2 -2
package/dist/index.esm5.js
CHANGED
|
@@ -583,6 +583,14 @@ var ErrorCode;
|
|
|
583
583
|
* See the License for the specific language governing permissions and
|
|
584
584
|
* limitations under the License.
|
|
585
585
|
*/
|
|
586
|
+
/**
|
|
587
|
+
* Handles network logic for all Storage Requests, including error reporting and
|
|
588
|
+
* retries with backoff.
|
|
589
|
+
*
|
|
590
|
+
* @param I - the type of the backend's network response.
|
|
591
|
+
* @param - O the output type used by the rest of the SDK. The conversion
|
|
592
|
+
* happens in the specified `callback_`.
|
|
593
|
+
*/
|
|
586
594
|
var NetworkRequest = /** @class */ (function () {
|
|
587
595
|
function NetworkRequest(url_, method_, headers_, body_, successCodes_, additionalRetryCodes_, callback_, errorCallback_, timeout_, progressCallback_, connectionFactory_) {
|
|
588
596
|
var _this = this;
|
|
@@ -661,7 +669,7 @@ var NetworkRequest = /** @class */ (function () {
|
|
|
661
669
|
var connection = status.connection;
|
|
662
670
|
if (status.wasSuccessCode) {
|
|
663
671
|
try {
|
|
664
|
-
var result = _this.callback_(connection, connection.
|
|
672
|
+
var result = _this.callback_(connection, connection.getResponse());
|
|
665
673
|
if (isJustDef(result)) {
|
|
666
674
|
resolve(result);
|
|
667
675
|
}
|
|
@@ -676,7 +684,7 @@ var NetworkRequest = /** @class */ (function () {
|
|
|
676
684
|
else {
|
|
677
685
|
if (connection !== null) {
|
|
678
686
|
var err = unknown();
|
|
679
|
-
err.serverResponse = connection.
|
|
687
|
+
err.serverResponse = connection.getErrorText();
|
|
680
688
|
if (_this.errorCallback_) {
|
|
681
689
|
reject(_this.errorCallback_(connection, err));
|
|
682
690
|
}
|
|
@@ -809,7 +817,7 @@ function getBlobBuilder() {
|
|
|
809
817
|
* @param args The values that will make up the resulting blob.
|
|
810
818
|
* @return The blob.
|
|
811
819
|
*/
|
|
812
|
-
function getBlob() {
|
|
820
|
+
function getBlob$1() {
|
|
813
821
|
var args = [];
|
|
814
822
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
815
823
|
args[_i] = arguments[_i];
|
|
@@ -1169,7 +1177,7 @@ var FbsBlob = /** @class */ (function () {
|
|
|
1169
1177
|
return val;
|
|
1170
1178
|
}
|
|
1171
1179
|
});
|
|
1172
|
-
return new FbsBlob(getBlob.apply(null, blobby));
|
|
1180
|
+
return new FbsBlob(getBlob$1.apply(null, blobby));
|
|
1173
1181
|
}
|
|
1174
1182
|
else {
|
|
1175
1183
|
var uint8Arrays = args.map(function (val) {
|
|
@@ -1495,6 +1503,12 @@ function fromResponseString(service, bucket, resourceString) {
|
|
|
1495
1503
|
return fromBackendResponse(service, bucket, resource);
|
|
1496
1504
|
}
|
|
1497
1505
|
|
|
1506
|
+
/**
|
|
1507
|
+
* Contains a fully specified request.
|
|
1508
|
+
*
|
|
1509
|
+
* @param I - the type of the backend's network response.
|
|
1510
|
+
* @param O - the output response type used by the rest of the SDK.
|
|
1511
|
+
*/
|
|
1498
1512
|
var RequestInfo = /** @class */ (function () {
|
|
1499
1513
|
function RequestInfo(url, method,
|
|
1500
1514
|
/**
|
|
@@ -1579,7 +1593,7 @@ function sharedErrorHandler(location) {
|
|
|
1579
1593
|
if (
|
|
1580
1594
|
// This exact message string is the only consistent part of the
|
|
1581
1595
|
// server's error response that identifies it as an App Check error.
|
|
1582
|
-
xhr.
|
|
1596
|
+
xhr.getErrorText().includes('Firebase App Check token is invalid')) {
|
|
1583
1597
|
newErr = unauthorizedApp();
|
|
1584
1598
|
}
|
|
1585
1599
|
else {
|
|
@@ -1651,6 +1665,19 @@ function list$2(service, location, delimiter, pageToken, maxResults) {
|
|
|
1651
1665
|
requestInfo.errorHandler = sharedErrorHandler(location);
|
|
1652
1666
|
return requestInfo;
|
|
1653
1667
|
}
|
|
1668
|
+
function getBytes$1(service, location, maxDownloadSizeBytes) {
|
|
1669
|
+
var urlPart = location.fullServerUrl();
|
|
1670
|
+
var url = makeUrl(urlPart, service.host, service._protocol) + '?alt=media';
|
|
1671
|
+
var method = 'GET';
|
|
1672
|
+
var timeout = service.maxOperationRetryTime;
|
|
1673
|
+
var requestInfo = new RequestInfo(url, method, function (_, data) { return data; }, timeout);
|
|
1674
|
+
requestInfo.errorHandler = objectErrorHandler(location);
|
|
1675
|
+
if (maxDownloadSizeBytes !== undefined) {
|
|
1676
|
+
requestInfo.headers['Range'] = "bytes=0-" + maxDownloadSizeBytes;
|
|
1677
|
+
requestInfo.successCodes = [200 /* OK */, 206 /* Partial Content */];
|
|
1678
|
+
}
|
|
1679
|
+
return requestInfo;
|
|
1680
|
+
}
|
|
1654
1681
|
function getDownloadUrl(service, location, mappings) {
|
|
1655
1682
|
var urlPart = location.fullServerUrl();
|
|
1656
1683
|
var url = makeUrl(urlPart, service.host, service._protocol);
|
|
@@ -2063,7 +2090,7 @@ function async(f) {
|
|
|
2063
2090
|
* limitations under the License.
|
|
2064
2091
|
*/
|
|
2065
2092
|
/** An override for the text-based Connection. Used in tests. */
|
|
2066
|
-
var
|
|
2093
|
+
var textFactoryOverride = null;
|
|
2067
2094
|
/**
|
|
2068
2095
|
* Network layer for browsers. We use this instead of goog.net.XhrIo because
|
|
2069
2096
|
* goog.net.XhrIo is hyuuuuge and doesn't work in React Native on Android.
|
|
@@ -2073,6 +2100,7 @@ var XhrConnection = /** @class */ (function () {
|
|
|
2073
2100
|
var _this = this;
|
|
2074
2101
|
this.sent_ = false;
|
|
2075
2102
|
this.xhr_ = new XMLHttpRequest();
|
|
2103
|
+
this.initXhr();
|
|
2076
2104
|
this.errorCode_ = ErrorCode.NO_ERROR;
|
|
2077
2105
|
this.sendPromise_ = new Promise(function (resolve) {
|
|
2078
2106
|
_this.xhr_.addEventListener('abort', function () {
|
|
@@ -2126,11 +2154,17 @@ var XhrConnection = /** @class */ (function () {
|
|
|
2126
2154
|
return -1;
|
|
2127
2155
|
}
|
|
2128
2156
|
};
|
|
2129
|
-
XhrConnection.prototype.
|
|
2157
|
+
XhrConnection.prototype.getResponse = function () {
|
|
2130
2158
|
if (!this.sent_) {
|
|
2131
|
-
throw internalError('cannot .
|
|
2159
|
+
throw internalError('cannot .getResponse() before sending');
|
|
2132
2160
|
}
|
|
2133
|
-
return this.xhr_.
|
|
2161
|
+
return this.xhr_.response;
|
|
2162
|
+
};
|
|
2163
|
+
XhrConnection.prototype.getErrorText = function () {
|
|
2164
|
+
if (!this.sent_) {
|
|
2165
|
+
throw internalError('cannot .getErrorText() before sending');
|
|
2166
|
+
}
|
|
2167
|
+
return this.xhr_.statusText;
|
|
2134
2168
|
};
|
|
2135
2169
|
/** Aborts the request. */
|
|
2136
2170
|
XhrConnection.prototype.abort = function () {
|
|
@@ -2151,10 +2185,44 @@ var XhrConnection = /** @class */ (function () {
|
|
|
2151
2185
|
};
|
|
2152
2186
|
return XhrConnection;
|
|
2153
2187
|
}());
|
|
2154
|
-
function
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2188
|
+
var XhrTextConnection = /** @class */ (function (_super) {
|
|
2189
|
+
__extends(XhrTextConnection, _super);
|
|
2190
|
+
function XhrTextConnection() {
|
|
2191
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
2192
|
+
}
|
|
2193
|
+
XhrTextConnection.prototype.initXhr = function () {
|
|
2194
|
+
this.xhr_.responseType = 'text';
|
|
2195
|
+
};
|
|
2196
|
+
return XhrTextConnection;
|
|
2197
|
+
}(XhrConnection));
|
|
2198
|
+
function newTextConnection() {
|
|
2199
|
+
return textFactoryOverride ? textFactoryOverride() : new XhrTextConnection();
|
|
2200
|
+
}
|
|
2201
|
+
var XhrBytesConnection = /** @class */ (function (_super) {
|
|
2202
|
+
__extends(XhrBytesConnection, _super);
|
|
2203
|
+
function XhrBytesConnection() {
|
|
2204
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
2205
|
+
}
|
|
2206
|
+
XhrBytesConnection.prototype.initXhr = function () {
|
|
2207
|
+
this.xhr_.responseType = 'arraybuffer';
|
|
2208
|
+
};
|
|
2209
|
+
return XhrBytesConnection;
|
|
2210
|
+
}(XhrConnection));
|
|
2211
|
+
function newBytesConnection() {
|
|
2212
|
+
return new XhrBytesConnection();
|
|
2213
|
+
}
|
|
2214
|
+
var XhrBlobConnection = /** @class */ (function (_super) {
|
|
2215
|
+
__extends(XhrBlobConnection, _super);
|
|
2216
|
+
function XhrBlobConnection() {
|
|
2217
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
2218
|
+
}
|
|
2219
|
+
XhrBlobConnection.prototype.initXhr = function () {
|
|
2220
|
+
this.xhr_.responseType = 'blob';
|
|
2221
|
+
};
|
|
2222
|
+
return XhrBlobConnection;
|
|
2223
|
+
}(XhrConnection));
|
|
2224
|
+
function newBlobConnection() {
|
|
2225
|
+
return new XhrBlobConnection();
|
|
2158
2226
|
}
|
|
2159
2227
|
|
|
2160
2228
|
/**
|
|
@@ -2302,7 +2370,7 @@ var UploadTask = /** @class */ (function () {
|
|
|
2302
2370
|
var _this = this;
|
|
2303
2371
|
this._resolveToken(function (authToken, appCheckToken) {
|
|
2304
2372
|
var requestInfo = createResumableUpload(_this._ref.storage, _this._ref._location, _this._mappings, _this._blob, _this._metadata);
|
|
2305
|
-
var createRequest = _this._ref.storage._makeRequest(requestInfo,
|
|
2373
|
+
var createRequest = _this._ref.storage._makeRequest(requestInfo, newTextConnection, authToken, appCheckToken);
|
|
2306
2374
|
_this._request = createRequest;
|
|
2307
2375
|
createRequest.getPromise().then(function (url) {
|
|
2308
2376
|
_this._request = undefined;
|
|
@@ -2318,7 +2386,7 @@ var UploadTask = /** @class */ (function () {
|
|
|
2318
2386
|
var url = this._uploadUrl;
|
|
2319
2387
|
this._resolveToken(function (authToken, appCheckToken) {
|
|
2320
2388
|
var requestInfo = getResumableUploadStatus(_this._ref.storage, _this._ref._location, url, _this._blob);
|
|
2321
|
-
var statusRequest = _this._ref.storage._makeRequest(requestInfo,
|
|
2389
|
+
var statusRequest = _this._ref.storage._makeRequest(requestInfo, newTextConnection, authToken, appCheckToken);
|
|
2322
2390
|
_this._request = statusRequest;
|
|
2323
2391
|
statusRequest.getPromise().then(function (status) {
|
|
2324
2392
|
status = status;
|
|
@@ -2348,7 +2416,7 @@ var UploadTask = /** @class */ (function () {
|
|
|
2348
2416
|
_this._transition("error" /* ERROR */);
|
|
2349
2417
|
return;
|
|
2350
2418
|
}
|
|
2351
|
-
var uploadRequest = _this._ref.storage._makeRequest(requestInfo,
|
|
2419
|
+
var uploadRequest = _this._ref.storage._makeRequest(requestInfo, newTextConnection, authToken, appCheckToken);
|
|
2352
2420
|
_this._request = uploadRequest;
|
|
2353
2421
|
uploadRequest.getPromise().then(function (newStatus) {
|
|
2354
2422
|
_this._increaseMultiplier();
|
|
@@ -2375,7 +2443,7 @@ var UploadTask = /** @class */ (function () {
|
|
|
2375
2443
|
var _this = this;
|
|
2376
2444
|
this._resolveToken(function (authToken, appCheckToken) {
|
|
2377
2445
|
var requestInfo = getMetadata$2(_this._ref.storage, _this._ref._location, _this._mappings);
|
|
2378
|
-
var metadataRequest = _this._ref.storage._makeRequest(requestInfo,
|
|
2446
|
+
var metadataRequest = _this._ref.storage._makeRequest(requestInfo, newTextConnection, authToken, appCheckToken);
|
|
2379
2447
|
_this._request = metadataRequest;
|
|
2380
2448
|
metadataRequest.getPromise().then(function (metadata) {
|
|
2381
2449
|
_this._request = undefined;
|
|
@@ -2388,7 +2456,7 @@ var UploadTask = /** @class */ (function () {
|
|
|
2388
2456
|
var _this = this;
|
|
2389
2457
|
this._resolveToken(function (authToken, appCheckToken) {
|
|
2390
2458
|
var requestInfo = multipartUpload(_this._ref.storage, _this._ref._location, _this._mappings, _this._blob, _this._metadata);
|
|
2391
|
-
var multipartRequest = _this._ref.storage._makeRequest(requestInfo,
|
|
2459
|
+
var multipartRequest = _this._ref.storage._makeRequest(requestInfo, newTextConnection, authToken, appCheckToken);
|
|
2392
2460
|
_this._request = multipartRequest;
|
|
2393
2461
|
multipartRequest.getPromise().then(function (metadata) {
|
|
2394
2462
|
_this._request = undefined;
|
|
@@ -2785,6 +2853,38 @@ var Reference = /** @class */ (function () {
|
|
|
2785
2853
|
};
|
|
2786
2854
|
return Reference;
|
|
2787
2855
|
}());
|
|
2856
|
+
/**
|
|
2857
|
+
* Download the bytes at the object's location.
|
|
2858
|
+
* @returns A Promise containing the downloaded bytes.
|
|
2859
|
+
*/
|
|
2860
|
+
function getBytesInternal(ref, maxDownloadSizeBytes) {
|
|
2861
|
+
ref._throwIfRoot('getBytes');
|
|
2862
|
+
var requestInfo = getBytes$1(ref.storage, ref._location, maxDownloadSizeBytes);
|
|
2863
|
+
return ref.storage
|
|
2864
|
+
.makeRequestWithTokens(requestInfo, newBytesConnection)
|
|
2865
|
+
.then(function (bytes) {
|
|
2866
|
+
return maxDownloadSizeBytes !== undefined
|
|
2867
|
+
? // GCS may not honor the Range header for small files
|
|
2868
|
+
bytes.slice(0, maxDownloadSizeBytes)
|
|
2869
|
+
: bytes;
|
|
2870
|
+
});
|
|
2871
|
+
}
|
|
2872
|
+
/**
|
|
2873
|
+
* Download the bytes at the object's location.
|
|
2874
|
+
* @returns A Promise containing the downloaded blob.
|
|
2875
|
+
*/
|
|
2876
|
+
function getBlobInternal(ref, maxDownloadSizeBytes) {
|
|
2877
|
+
ref._throwIfRoot('getBlob');
|
|
2878
|
+
var requestInfo = getBytes$1(ref.storage, ref._location, maxDownloadSizeBytes);
|
|
2879
|
+
return ref.storage
|
|
2880
|
+
.makeRequestWithTokens(requestInfo, newBlobConnection)
|
|
2881
|
+
.then(function (blob) {
|
|
2882
|
+
return maxDownloadSizeBytes !== undefined
|
|
2883
|
+
? // GCS may not honor the Range header for small files
|
|
2884
|
+
blob.slice(0, maxDownloadSizeBytes)
|
|
2885
|
+
: blob;
|
|
2886
|
+
});
|
|
2887
|
+
}
|
|
2788
2888
|
/**
|
|
2789
2889
|
* Uploads data to this object's location.
|
|
2790
2890
|
* The upload is not resumable.
|
|
@@ -2798,7 +2898,7 @@ function uploadBytes$1(ref, data, metadata) {
|
|
|
2798
2898
|
ref._throwIfRoot('uploadBytes');
|
|
2799
2899
|
var requestInfo = multipartUpload(ref.storage, ref._location, getMappings(), new FbsBlob(data, true), metadata);
|
|
2800
2900
|
return ref.storage
|
|
2801
|
-
.makeRequestWithTokens(requestInfo,
|
|
2901
|
+
.makeRequestWithTokens(requestInfo, newTextConnection)
|
|
2802
2902
|
.then(function (finalMetadata) {
|
|
2803
2903
|
return {
|
|
2804
2904
|
metadata: finalMetadata,
|
|
@@ -2930,7 +3030,7 @@ function list$1(ref, options) {
|
|
|
2930
3030
|
var op = options || {};
|
|
2931
3031
|
var requestInfo = list$2(ref.storage, ref._location,
|
|
2932
3032
|
/*delimiter= */ '/', op.pageToken, op.maxResults);
|
|
2933
|
-
return ref.storage.makeRequestWithTokens(requestInfo,
|
|
3033
|
+
return ref.storage.makeRequestWithTokens(requestInfo, newTextConnection);
|
|
2934
3034
|
}
|
|
2935
3035
|
/**
|
|
2936
3036
|
* A `Promise` that resolves with the metadata for this object. If this
|
|
@@ -2942,7 +3042,7 @@ function list$1(ref, options) {
|
|
|
2942
3042
|
function getMetadata$1(ref) {
|
|
2943
3043
|
ref._throwIfRoot('getMetadata');
|
|
2944
3044
|
var requestInfo = getMetadata$2(ref.storage, ref._location, getMappings());
|
|
2945
|
-
return ref.storage.makeRequestWithTokens(requestInfo,
|
|
3045
|
+
return ref.storage.makeRequestWithTokens(requestInfo, newTextConnection);
|
|
2946
3046
|
}
|
|
2947
3047
|
/**
|
|
2948
3048
|
* Updates the metadata for this object.
|
|
@@ -2958,7 +3058,7 @@ function getMetadata$1(ref) {
|
|
|
2958
3058
|
function updateMetadata$1(ref, metadata) {
|
|
2959
3059
|
ref._throwIfRoot('updateMetadata');
|
|
2960
3060
|
var requestInfo = updateMetadata$2(ref.storage, ref._location, metadata, getMappings());
|
|
2961
|
-
return ref.storage.makeRequestWithTokens(requestInfo,
|
|
3061
|
+
return ref.storage.makeRequestWithTokens(requestInfo, newTextConnection);
|
|
2962
3062
|
}
|
|
2963
3063
|
/**
|
|
2964
3064
|
* Returns the download URL for the given Reference.
|
|
@@ -2970,7 +3070,7 @@ function getDownloadURL$1(ref) {
|
|
|
2970
3070
|
ref._throwIfRoot('getDownloadURL');
|
|
2971
3071
|
var requestInfo = getDownloadUrl(ref.storage, ref._location, getMappings());
|
|
2972
3072
|
return ref.storage
|
|
2973
|
-
.makeRequestWithTokens(requestInfo,
|
|
3073
|
+
.makeRequestWithTokens(requestInfo, newTextConnection)
|
|
2974
3074
|
.then(function (url) {
|
|
2975
3075
|
if (url === null) {
|
|
2976
3076
|
throw noDownloadURL();
|
|
@@ -2987,7 +3087,7 @@ function getDownloadURL$1(ref) {
|
|
|
2987
3087
|
function deleteObject$1(ref) {
|
|
2988
3088
|
ref._throwIfRoot('deleteObject');
|
|
2989
3089
|
var requestInfo = deleteObject$2(ref.storage, ref._location);
|
|
2990
|
-
return ref.storage.makeRequestWithTokens(requestInfo,
|
|
3090
|
+
return ref.storage.makeRequestWithTokens(requestInfo, newTextConnection);
|
|
2991
3091
|
}
|
|
2992
3092
|
/**
|
|
2993
3093
|
* Returns reference for object obtained by appending `childPath` to `ref`.
|
|
@@ -3287,7 +3387,7 @@ var FirebaseStorageImpl = /** @class */ (function () {
|
|
|
3287
3387
|
}());
|
|
3288
3388
|
|
|
3289
3389
|
var name = "@firebase/storage";
|
|
3290
|
-
var version = "0.
|
|
3390
|
+
var version = "0.9.0";
|
|
3291
3391
|
|
|
3292
3392
|
/**
|
|
3293
3393
|
* @license
|
|
@@ -3326,6 +3426,24 @@ var STORAGE_TYPE = 'storage';
|
|
|
3326
3426
|
* See the License for the specific language governing permissions and
|
|
3327
3427
|
* limitations under the License.
|
|
3328
3428
|
*/
|
|
3429
|
+
/**
|
|
3430
|
+
* Downloads the data at the object's location. Returns an error if the object
|
|
3431
|
+
* is not found.
|
|
3432
|
+
*
|
|
3433
|
+
* To use this functionality, you have to whitelist your app's origin in your
|
|
3434
|
+
* Cloud Storage bucket. See also
|
|
3435
|
+
* https://cloud.google.com/storage/docs/configuring-cors
|
|
3436
|
+
*
|
|
3437
|
+
* @public
|
|
3438
|
+
* @param ref - StorageReference where data should be downloaded.
|
|
3439
|
+
* @param maxDownloadSizeBytes - If set, the maximum allowed size in bytes to
|
|
3440
|
+
* retrieve.
|
|
3441
|
+
* @returns A Promise containing the object's bytes
|
|
3442
|
+
*/
|
|
3443
|
+
function getBytes(ref, maxDownloadSizeBytes) {
|
|
3444
|
+
ref = getModularInstance(ref);
|
|
3445
|
+
return getBytesInternal(ref, maxDownloadSizeBytes);
|
|
3446
|
+
}
|
|
3329
3447
|
/**
|
|
3330
3448
|
* Uploads data to this object's location.
|
|
3331
3449
|
* The upload is not resumable.
|
|
@@ -3502,6 +3620,58 @@ function connectStorageEmulator(storage, host, port, options) {
|
|
|
3502
3620
|
connectStorageEmulator$1(storage, host, port, options);
|
|
3503
3621
|
}
|
|
3504
3622
|
|
|
3623
|
+
/**
|
|
3624
|
+
* @license
|
|
3625
|
+
* Copyright 2021 Google LLC
|
|
3626
|
+
*
|
|
3627
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3628
|
+
* you may not use this file except in compliance with the License.
|
|
3629
|
+
* You may obtain a copy of the License at
|
|
3630
|
+
*
|
|
3631
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3632
|
+
*
|
|
3633
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3634
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3635
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3636
|
+
* See the License for the specific language governing permissions and
|
|
3637
|
+
* limitations under the License.
|
|
3638
|
+
*/
|
|
3639
|
+
/**
|
|
3640
|
+
* Downloads the data at the object's location. Returns an error if the object
|
|
3641
|
+
* is not found.
|
|
3642
|
+
*
|
|
3643
|
+
* To use this functionality, you have to whitelist your app's origin in your
|
|
3644
|
+
* Cloud Storage bucket. See also
|
|
3645
|
+
* https://cloud.google.com/storage/docs/configuring-cors
|
|
3646
|
+
*
|
|
3647
|
+
* This API is not available in Node.
|
|
3648
|
+
*
|
|
3649
|
+
* @public
|
|
3650
|
+
* @param ref - StorageReference where data should be downloaded.
|
|
3651
|
+
* @param maxDownloadSizeBytes - If set, the maximum allowed size in bytes to
|
|
3652
|
+
* retrieve.
|
|
3653
|
+
* @returns A Promise that resolves with a Blob containing the object's bytes
|
|
3654
|
+
*/
|
|
3655
|
+
function getBlob(ref, maxDownloadSizeBytes) {
|
|
3656
|
+
ref = getModularInstance(ref);
|
|
3657
|
+
return getBlobInternal(ref, maxDownloadSizeBytes);
|
|
3658
|
+
}
|
|
3659
|
+
/**
|
|
3660
|
+
* Downloads the data at the object's location. Raises an error event if the
|
|
3661
|
+
* object is not found.
|
|
3662
|
+
*
|
|
3663
|
+
* This API is only available in Node.
|
|
3664
|
+
*
|
|
3665
|
+
* @public
|
|
3666
|
+
* @param ref - StorageReference where data should be downloaded.
|
|
3667
|
+
* @param maxDownloadSizeBytes - If set, the maximum allowed size in bytes to
|
|
3668
|
+
* retrieve.
|
|
3669
|
+
* @returns A stream with the object's data as bytes
|
|
3670
|
+
*/
|
|
3671
|
+
function getStream(ref, maxDownloadSizeBytes) {
|
|
3672
|
+
throw new Error('getStream() is only supported by NodeJS builds');
|
|
3673
|
+
}
|
|
3674
|
+
|
|
3505
3675
|
/**
|
|
3506
3676
|
* Cloud Storage for Firebase
|
|
3507
3677
|
*
|
|
@@ -3523,5 +3693,5 @@ function registerStorage() {
|
|
|
3523
3693
|
}
|
|
3524
3694
|
registerStorage();
|
|
3525
3695
|
|
|
3526
|
-
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 };
|
|
3696
|
+
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 };
|
|
3527
3697
|
//# sourceMappingURL=index.esm5.js.map
|