LuxChat  2.0
Instant messenger for iOS
Instance Methods | Properties | List of all members
FIRStorageReference Class Reference

#import <FIRStorageReference.h>

Inheritance diagram for FIRStorageReference:

Instance Methods

(FIRStorageReference *) - root
 
(nullable FIRStorageReference *) - parent
 
(FIRStorageReference *) - child:
 
(FIRStorageUploadTask *) - putData:
 
(FIRStorageUploadTask *) - putData:metadata:
 
(FIRStorageUploadTask *) - putData:metadata:completion:
 
(FIRStorageUploadTask *) - putFile:
 
(FIRStorageUploadTask *) - putFile:metadata:
 
(FIRStorageUploadTask *) - putFile:metadata:completion:
 
(FIRStorageDownloadTask *) - dataWithMaxSize:completion:
 
(void) - downloadURLWithCompletion:
 
(FIRStorageDownloadTask *) - writeToFile:
 
(FIRStorageDownloadTask *) - writeToFile:completion:
 
(void) - metadataWithCompletion:
 
(void) - updateMetadata:completion:
 
(void) - deleteWithCompletion:
 

Properties

FIRStoragestorage
 
NSString * bucket
 
NSString * fullPath
 
NSString * name
 

Detailed Description

FIRStorageReference represents a reference to a Google Cloud Storage object. Developers can upload and download objects, as well as get/set object metadata, and delete an object at the path.

See also
https://cloud.google.com/storage/

Method Documentation

- (FIRStorageReference *) child: (NSString *)  path

Creates a new FIRStorageReference pointing to a child object of the current reference. path = foo child = bar newPath = foo/bar path = foo/bar child = baz newPath = foo/bar/baz All leading and trailing slashes will be removed, and consecutive slashes will be compressed to single slashes. For example: child = /foo/bar newPath = foo/bar child = foo/bar/ newPath = foo/bar child = foo///bar newPath = foo/bar

Parameters
pathPath to append to the current path.
Returns
A new FIRStorageReference pointing to a child location of the current reference.
- (FIRStorageDownloadTask *) dataWithMaxSize: (int64_t)  size
completion: (void(^)(NSData *_Nullable data, NSError *_Nullable error))  completion 

Asynchronously downloads the object at the FIRStorageReference to an NSData object in memory. An NSData of the provided max size will be allocated, so ensure that the device has enough free memory to complete the download. For downloading large files, writeToFile may be a better option.

Parameters
sizeThe maximum size in bytes to download. If the download exceeds this size the task will be cancelled and an error will be returned.
completionA completion block that either returns the object data on success, or an error on failure.
Returns
An FIRStorageDownloadTask that can be used to monitor or manage the download.
- (void) deleteWithCompletion: (nullable void(^)(NSError *_Nullable error))  completion

Deletes the object at the current path.

Parameters
completionA completion block which returns nil on success, or an error on failure.
- (void) downloadURLWithCompletion: (void(^)(NSURL *_Nullable URL, NSError *_Nullable error))  completion

Asynchronously retrieves a long lived download URL with a revokable token. This can be used to share the file with others, but can be revoked by a developer in the Firebase Console if desired.

Parameters
completionA completion block that either returns the URL on success, or an error on failure.
- (void) metadataWithCompletion: (void(^)(FIRStorageMetadata *_Nullable metadata, NSError *_Nullable error))  completion

Retrieves metadata associated with an object at the current path.

Parameters
completionA completion block which returns the object metadata on success, or an error on failure.
- (nullable FIRStorageReference *) parent

Creates a new FIRStorageReference pointing to the parent of the current reference or nil if this instance references the root location. For example: path = foo/bar/baz parent = foo/bar path = foo parent = (root) path = (root) parent = nil

Returns
A new FIRStorageReference pointing to the parent of the current reference.
- (FIRStorageUploadTask *) putData: (NSData *)  uploadData

Asynchronously uploads data to the currently specified FIRStorageReference, without additional metadata. This is not recommended for large files, and one should instead upload a file from disk.

Parameters
uploadDataThe NSData to upload.
Returns
An instance of FIRStorageUploadTask, which can be used to monitor or manage the upload.
- (FIRStorageUploadTask *) putData: (NSData *)  uploadData
metadata: (nullable FIRStorageMetadata *)  metadata 

Asynchronously uploads data to the currently specified FIRStorageReference. This is not recommended for large files, and one should instead upload a file from disk.

Parameters
uploadDataThe NSData to upload.
metadataFIRStorageMetadata containing additional information (MIME type, etc.) about the object being uploaded.
Returns
An instance of FIRStorageUploadTask, which can be used to monitor or manage the upload.
- (FIRStorageUploadTask *) putData: (NSData *)  uploadData
metadata: (nullable FIRStorageMetadata *)  metadata
completion: (nullable void(^)(FIRStorageMetadata *_Nullable metadata, NSError *_Nullable error))  completion 

Asynchronously uploads data to the currently specified FIRStorageReference. This is not recommended for large files, and one should instead upload a file from disk.

Parameters
uploadDataThe NSData to upload.
metadataFIRStorageMetadata containing additional information (MIME type, etc.) about the object being uploaded.
completionA completion block that either returns the object metadata on success, or an error on failure.
Returns
An instance of FIRStorageUploadTask, which can be used to monitor or manage the upload.
- (FIRStorageUploadTask *) putFile: (NSURL *)  fileURL

Asynchronously uploads a file to the currently specified FIRStorageReference, without additional metadata.

Parameters
fileURLA URL representing the system file path of the object to be uploaded.
Returns
An instance of FIRStorageUploadTask, which can be used to monitor or manage the upload.
- (FIRStorageUploadTask *) putFile: (NSURL *)  fileURL
metadata: (nullable FIRStorageMetadata *)  metadata 

Asynchronously uploads a file to the currently specified FIRStorageReference.

Parameters
fileURLA URL representing the system file path of the object to be uploaded.
metadataFIRStorageMetadata containing additional information (MIME type, etc.) about the object being uploaded.
Returns
An instance of FIRStorageUploadTask, which can be used to monitor or manage the upload.
- (FIRStorageUploadTask *) putFile: (NSURL *)  fileURL
metadata: (nullable FIRStorageMetadata *)  metadata
completion: (nullable void(^)(FIRStorageMetadata *_Nullable metadata, NSError *_Nullable error))  completion 

Asynchronously uploads a file to the currently specified FIRStorageReference.

Parameters
fileURLA URL representing the system file path of the object to be uploaded.
metadataFIRStorageMetadata containing additional information (MIME type, etc.) about the object being uploaded.
completionA completion block that either returns the object metadata on success, or an error on failure.
Returns
An instance of FIRStorageUploadTask, which can be used to monitor or manage the upload.
- (FIRStorageReference *) root

Creates a new FIRStorageReference pointing to the root object.

Returns
A new FIRStorageReference pointing to the root object.
- (void) updateMetadata: (FIRStorageMetadata *)  metadata
completion: (nullable void(^)(FIRStorageMetadata *_Nullable metadata, NSError *_Nullable error))  completion 

Updates the metadata associated with an object at the current path.

Parameters
metadataAn FIRStorageMetadata object with the metadata to update.
completionA completion block which returns the FIRStorageMetadata on success, or an error on failure.
- (FIRStorageDownloadTask *) writeToFile: (NSURL *)  fileURL

Asynchronously downloads the object at the current path to a specified system filepath.

Parameters
fileURLA file system URL representing the path the object should be downloaded to.
Returns
An FIRStorageDownloadTask that can be used to monitor or manage the download.
- (FIRStorageDownloadTask *) writeToFile: (NSURL *)  fileURL
completion: (nullable void(^)(NSURL *_Nullable URL, NSError *_Nullable error))  completion 

Asynchronously downloads the object at the current path to a specified system filepath.

Parameters
fileURLA file system URL representing the path the object should be downloaded to.
completionA completion block that fires when the file download completes. Returns an NSURL pointing to the file path of the downloaded file on success, or an error on failure.
Returns
An FIRStorageDownloadTask that can be used to monitor or manage the download.

Property Documentation

- (NSString*) bucket
readnonatomicassign

The name of the Google Cloud Storage bucket associated with this reference, in gs://bucket/path/to/object.txt, the bucket would be: 'bucket'

- (NSString*) fullPath
readnonatomicassign

The full path to this object, not including the Google Cloud Storage bucket. In gs://bucket/path/to/object.txt, the full path would be: 'path/to/object.txt'

- (NSString*) name
readnonatomicassign

The short name of the object associated with this reference, in gs://bucket/path/to/object.txt, the name of the object would be: 'object.txt'

- (FIRStorage*) storage
readnonatomicassign

The FIRStorage service object which created this reference.


The documentation for this class was generated from the following file: