Gets the Storage service for the default
app or a given app.
firebase.storage() can be called with no arguments to access the default
app's Storage service or as
firebase.storage(app) to access the
Storage service associated with a
specific app.
example
// Get the Storage service for the default appvar defaultStorage = firebase.storage();
example
// Get the Storage service for a given appvar otherStorage = firebase.storage(otherApp);
Indicates the string should be interpreted as base64-encoded data.
Padding characters (trailing '='s) are optional.
Example: The string 'rWmO++E6t7/rlw==' becomes the byte sequence
ad 69 8e fb e1 3a b7 bf eb 97
Indicates the string should be interpreted as base64url-encoded data.
Padding characters (trailing '='s) are optional.
Example: The string 'rWmO--E6t7_rlw==' becomes the byte sequence
ad 69 8e fb e1 3a b7 bf eb 97
Indicates the string is a data URL, such as one obtained from
canvas.toDataURL().
Example: the string 'data:application/octet-stream;base64,aaaa'
becomes the byte sequence
69 a6 9a
(the content-type "application/octet-stream" is also applied, but can
be overridden in the metadata object).
Indicates the string should be interpreted "raw", that is, as normal text.
The string will be interpreted as UTF-16, then uploaded as a UTF-8 byte
sequence.
Example: The string 'Hello! \ud83d\ude0a' becomes the byte sequence
48 65 6c 6c 6f 21 20 f0 9f 98 8a
The `next` function is triggered on progress updates and when the
task is paused/resumed with a
firebase.storage.UploadTaskSnapshot as the first
argument.
The `error` function is triggered if the upload is canceled or fails
for another reason.
The `complete` function is triggered if the upload completes
successfully.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-09-28 UTC."],[],[],null,["- [firebase](/docs/reference/js/v8/firebase).\n- storage \n\nCallable\n\n- storage ( app ? : [App](/docs/reference/js/v8/firebase.app.App) ) : [Storage](/docs/reference/js/v8/firebase.storage.Storage)\n- Gets the [`Storage`](/docs/reference/js/v8/firebase.storage.Storage) service for the default\n app or a given app.\n\n `firebase.storage()` can be called with no arguments to access the default\n app's [`Storage`](/docs/reference/js/v8/firebase.storage.Storage) service or as\n `firebase.storage(app)` to access the\n [`Storage`](/docs/reference/js/v8/firebase.storage.Storage) service associated with a\n specific app.\n\n example\n :\n\n // Get the Storage service for the default app\n var defaultStorage = firebase.storage();\n\n\n example\n :\n\n // Get the Storage service for a given app\n var otherStorage = firebase.storage(otherApp);\n\n\n Parameters\n -\n\n Optional app: [App](/docs/reference/js/v8/firebase.app.App) \n The app to create a storage service for.\n If not passed, uses the default app.\n\n Returns [Storage](/docs/reference/js/v8/firebase.storage.Storage)\n\nIndex\n\nEnumerations\n\n- [StorageErrorCode](/docs/reference/js/v8/firebase.storage.StorageErrorCode)\n\nInterfaces\n\n- [FirebaseStorageError](/docs/reference/js/v8/firebase.storage.FirebaseStorageError)\n- [FullMetadata](/docs/reference/js/v8/firebase.storage.FullMetadata)\n- [ListOptions](/docs/reference/js/v8/firebase.storage.ListOptions)\n- [ListResult](/docs/reference/js/v8/firebase.storage.ListResult)\n- [Reference](/docs/reference/js/v8/firebase.storage.Reference)\n- [SettableMetadata](/docs/reference/js/v8/firebase.storage.SettableMetadata)\n- [Storage](/docs/reference/js/v8/firebase.storage.Storage)\n- [StorageObserver](/docs/reference/js/v8/firebase.storage.StorageObserver)\n- [UploadMetadata](/docs/reference/js/v8/firebase.storage.UploadMetadata)\n- [UploadTask](/docs/reference/js/v8/firebase.storage.UploadTask)\n- [UploadTaskSnapshot](/docs/reference/js/v8/firebase.storage.UploadTaskSnapshot)\n\nType aliases\n\n- [StringFormat](/docs/reference/js/v8/firebase.storage#stringformat)\n- [TaskEvent](/docs/reference/js/v8/firebase.storage#taskevent)\n- [TaskState](/docs/reference/js/v8/firebase.storage#taskstate)\n\nVariables\n\n- [StringFormat](/docs/reference/js/v8/firebase.storage#stringformat-1)\n- [TaskEvent](/docs/reference/js/v8/firebase.storage#taskevent-1)\n- [TaskState](/docs/reference/js/v8/firebase.storage#taskstate-1)\n\nType aliases\n\nStringFormat \nStringFormat: string \n\nTaskEvent \nTaskEvent: string \nAn event that is triggered on a task.\n\nsee\n\n: [firebase.storage.UploadTask.on](/docs/reference/js/v8/firebase.storage.UploadTask#on)\n\nTaskState \nTaskState: string \nRepresents the current state of a running upload.\n\nVariables\n\nStringFormat \nStringFormat: { BASE64: [StringFormat](/docs/reference/js/v8/firebase.storage#stringformat); BASE64URL: [StringFormat](/docs/reference/js/v8/firebase.storage#stringformat); DATA_URL: [StringFormat](/docs/reference/js/v8/firebase.storage#stringformat); RAW: [StringFormat](/docs/reference/js/v8/firebase.storage#stringformat) } \n\nType declaration\n\n-\n\n BASE64: [StringFormat](/docs/reference/js/v8/firebase.storage#stringformat) \n Indicates the string should be interpreted as base64-encoded data.\n Padding characters (trailing '='s) are optional.\n Example: The string 'rWmO++E6t7/rlw==' becomes the byte sequence\n ad 69 8e fb e1 3a b7 bf eb 97\n-\n\n BASE64URL: [StringFormat](/docs/reference/js/v8/firebase.storage#stringformat) \n Indicates the string should be interpreted as base64url-encoded data.\n Padding characters (trailing '='s) are optional.\n Example: The string 'rWmO--E6t7_rlw==' becomes the byte sequence\n ad 69 8e fb e1 3a b7 bf eb 97\n-\n\n DATA_URL: [StringFormat](/docs/reference/js/v8/firebase.storage#stringformat) \n Indicates the string is a data URL, such as one obtained from\n canvas.toDataURL().\n Example: the string 'data:application/octet-stream;base64,aaaa'\n becomes the byte sequence\n 69 a6 9a\n (the content-type \"application/octet-stream\" is also applied, but can\n be overridden in the metadata object).\n-\n\n RAW: [StringFormat](/docs/reference/js/v8/firebase.storage#stringformat) \n Indicates the string should be interpreted \"raw\", that is, as normal text.\n The string will be interpreted as UTF-16, then uploaded as a UTF-8 byte\n sequence.\n Example: The string 'Hello! \\\\ud83d\\\\ude0a' becomes the byte sequence\n 48 65 6c 6c 6f 21 20 f0 9f 98 8a\n\nTaskEvent \nTaskEvent: { STATE_CHANGED: [TaskEvent](/docs/reference/js/v8/firebase.storage#taskevent) } \n\nType declaration\n\n-\n\n STATE_CHANGED: [TaskEvent](/docs/reference/js/v8/firebase.storage#taskevent) \n For this event,\n - The \\`next\\` function is triggered on progress updates and when the task is paused/resumed with a [firebase.storage.UploadTaskSnapshot](/docs/reference/js/v8/firebase.storage.UploadTaskSnapshot) as the first argument.\n - The \\`error\\` function is triggered if the upload is canceled or fails for another reason.\n - The \\`complete\\` function is triggered if the upload completes successfully.\n\nTaskState \nTaskState: { CANCELED: [TaskState](/docs/reference/js/v8/firebase.storage#taskstate); ERROR: [TaskState](/docs/reference/js/v8/firebase.storage#taskstate); PAUSED: [TaskState](/docs/reference/js/v8/firebase.storage#taskstate); RUNNING: [TaskState](/docs/reference/js/v8/firebase.storage#taskstate); SUCCESS: [TaskState](/docs/reference/js/v8/firebase.storage#taskstate) } \n\nType declaration\n\n-\n\n CANCELED: [TaskState](/docs/reference/js/v8/firebase.storage#taskstate)\n-\n\n ERROR: [TaskState](/docs/reference/js/v8/firebase.storage#taskstate)\n-\n\n PAUSED: [TaskState](/docs/reference/js/v8/firebase.storage#taskstate)\n-\n\n RUNNING: [TaskState](/docs/reference/js/v8/firebase.storage#taskstate)\n-\n\nSUCCESS: [TaskState](/docs/reference/js/v8/firebase.storage#taskstate)"]]
Gets the
Storage
service for the default app or a given app.firebase.storage()
can be called with no arguments to access the default app'sStorage
service or asfirebase.storage(app)
to access theStorage
service associated with a specific app.// Get the Storage service for the default app var defaultStorage = firebase.storage();
// Get the Storage service for a given app var otherStorage = firebase.storage(otherApp);