@firebase/storage 0.12.6 → 0.13.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/dist/index.browser.cjs.js +4 -20
- package/dist/index.browser.cjs.js.map +1 -1
- package/dist/index.cjs.js +4 -20
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm2017.js +4 -20
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +4 -20
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +15 -33
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/node-esm/index.node.esm.js +15 -33
- package/dist/node-esm/index.node.esm.js.map +1 -1
- package/dist/node-esm/src/api.browser.d.ts +1 -2
- package/dist/node-esm/src/api.d.ts +1 -1
- package/dist/node-esm/src/api.node.d.ts +1 -2
- package/dist/node-esm/src/implementation/connection.d.ts +2 -3
- package/dist/node-esm/src/platform/browser/connection.d.ts +1 -2
- package/dist/node-esm/src/platform/connection.d.ts +1 -2
- package/dist/node-esm/src/platform/node/connection.d.ts +5 -5
- package/dist/node-esm/src/public-types.d.ts +1 -1
- package/dist/node-esm/src/reference.d.ts +2 -3
- package/dist/src/api.browser.d.ts +1 -2
- package/dist/src/api.d.ts +1 -1
- package/dist/src/api.node.d.ts +1 -2
- package/dist/src/implementation/connection.d.ts +2 -3
- package/dist/src/platform/browser/connection.d.ts +1 -2
- package/dist/src/platform/connection.d.ts +1 -2
- package/dist/src/platform/node/connection.d.ts +5 -5
- package/dist/src/public-types.d.ts +1 -1
- package/dist/src/reference.d.ts +2 -3
- package/dist/storage-public.d.ts +3 -4
- package/dist/storage.d.ts +5 -7
- package/package.json +3 -3
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { _getProvider, getApp, _registerComponent, registerVersion, SDK_VERSION } from '@firebase/app';
|
|
2
2
|
import { FirebaseError, createMockUserToken, getModularInstance, getDefaultEmulatorHostnameAndPort } from '@firebase/util';
|
|
3
|
-
import { Transform, PassThrough } from 'stream';
|
|
4
3
|
import { fetch } from 'undici';
|
|
5
4
|
import { Component } from '@firebase/component';
|
|
6
5
|
|
|
@@ -585,23 +584,7 @@ function makeQueryString(params) {
|
|
|
585
584
|
}
|
|
586
585
|
|
|
587
586
|
/**
|
|
588
|
-
*
|
|
589
|
-
* Copyright 2017 Google LLC
|
|
590
|
-
*
|
|
591
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
592
|
-
* you may not use this file except in compliance with the License.
|
|
593
|
-
* You may obtain a copy of the License at
|
|
594
|
-
*
|
|
595
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
596
|
-
*
|
|
597
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
598
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
599
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
600
|
-
* See the License for the specific language governing permissions and
|
|
601
|
-
* limitations under the License.
|
|
602
|
-
*/
|
|
603
|
-
/**
|
|
604
|
-
* Error codes for requests made by the the XhrIo wrapper.
|
|
587
|
+
* Error codes for requests made by the XhrIo wrapper.
|
|
605
588
|
*/
|
|
606
589
|
var ErrorCode;
|
|
607
590
|
(function (ErrorCode) {
|
|
@@ -2906,32 +2889,31 @@ function getBytesInternal(ref, maxDownloadSizeBytes) {
|
|
|
2906
2889
|
function getStreamInternal(ref, maxDownloadSizeBytes) {
|
|
2907
2890
|
ref._throwIfRoot('getStream');
|
|
2908
2891
|
const requestInfo = getBytes$1(ref.storage, ref._location, maxDownloadSizeBytes);
|
|
2909
|
-
|
|
2910
|
-
const newMaxSizeTransform = n => {
|
|
2892
|
+
// Transforms the stream so that only `maxDownloadSizeBytes` bytes are piped to the result
|
|
2893
|
+
const newMaxSizeTransform = (n) => {
|
|
2911
2894
|
let missingBytes = n;
|
|
2912
2895
|
return {
|
|
2913
|
-
transform(chunk,
|
|
2896
|
+
transform(chunk, controller) {
|
|
2914
2897
|
// GCS may not honor the Range header for small files
|
|
2915
2898
|
if (chunk.length < missingBytes) {
|
|
2916
|
-
|
|
2899
|
+
controller.enqueue(chunk);
|
|
2917
2900
|
missingBytes -= chunk.length;
|
|
2918
2901
|
}
|
|
2919
2902
|
else {
|
|
2920
|
-
|
|
2921
|
-
|
|
2903
|
+
controller.enqueue(chunk.slice(0, missingBytes));
|
|
2904
|
+
controller.terminate();
|
|
2922
2905
|
}
|
|
2923
|
-
callback();
|
|
2924
2906
|
}
|
|
2925
2907
|
};
|
|
2926
2908
|
};
|
|
2927
2909
|
const result = maxDownloadSizeBytes !== undefined
|
|
2928
|
-
? new
|
|
2929
|
-
: new
|
|
2910
|
+
? new TransformStream(newMaxSizeTransform(maxDownloadSizeBytes))
|
|
2911
|
+
: new TransformStream(); // The default transformer forwards all chunks to its readable side
|
|
2930
2912
|
ref.storage
|
|
2931
2913
|
.makeRequestWithTokens(requestInfo, newStreamConnection)
|
|
2932
|
-
.then(
|
|
2933
|
-
.catch(
|
|
2934
|
-
return result;
|
|
2914
|
+
.then(readableStream => readableStream.pipeThrough(result))
|
|
2915
|
+
.catch(err => result.writable.abort(err));
|
|
2916
|
+
return result.readable;
|
|
2935
2917
|
}
|
|
2936
2918
|
/**
|
|
2937
2919
|
* Uploads data to this object's location.
|
|
@@ -3067,7 +3049,7 @@ function list$1(ref, options) {
|
|
|
3067
3049
|
}
|
|
3068
3050
|
/**
|
|
3069
3051
|
* A `Promise` that resolves with the metadata for this object. If this
|
|
3070
|
-
* object doesn't exist or metadata cannot be
|
|
3052
|
+
* object doesn't exist or metadata cannot be retrieved, the promise is
|
|
3071
3053
|
* rejected.
|
|
3072
3054
|
* @public
|
|
3073
3055
|
* @param ref - StorageReference to get metadata from.
|
|
@@ -3377,7 +3359,7 @@ class FirebaseStorageImpl {
|
|
|
3377
3359
|
}
|
|
3378
3360
|
|
|
3379
3361
|
const name = "@firebase/storage";
|
|
3380
|
-
const version = "0.
|
|
3362
|
+
const version = "0.13.0";
|
|
3381
3363
|
|
|
3382
3364
|
/**
|
|
3383
3365
|
* @license
|
|
@@ -3476,7 +3458,7 @@ function uploadBytesResumable(ref, data, metadata) {
|
|
|
3476
3458
|
}
|
|
3477
3459
|
/**
|
|
3478
3460
|
* A `Promise` that resolves with the metadata for this object. If this
|
|
3479
|
-
* object doesn't exist or metadata cannot be
|
|
3461
|
+
* object doesn't exist or metadata cannot be retrieved, the promise is
|
|
3480
3462
|
* rejected.
|
|
3481
3463
|
* @public
|
|
3482
3464
|
* @param ref - {@link StorageReference} to get metadata from.
|