Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit aca5a89

Browse files
cleanup
1 parent 1150640 commit aca5a89

File tree

1 file changed

+0
-138
lines changed

1 file changed

+0
-138
lines changed

docs/FUNCTIONS.md

Lines changed: 0 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -53,141 +53,3 @@ fn("Nativescript-Plugin-Firebase!")
5353
.catch((errorMessage: string) => console.log("Callable Function Error: " + errorMessage));
5454
```
5555
</details>
56-
57-
### downloadFile
58-
As with `uploadFile` you can either pass in a full local path to a file, or (as a convenience) use the `file-system` module that comes shipped with {N} as standard.
59-
60-
In this example we'll download the previously uploaded file to a certain path on the local filesystem.
61-
62-
<details>
63-
<summary>Native API</summary>
64-
65-
```js
66-
// init the file-system module
67-
var fs = require("tns-core-modules/file-system");
68-
69-
// let's first determine where we'll create the file using the 'file-system' module
70-
var documents = fs.knownFolders.documents();
71-
var logoPath = documents.path + "/telerik-logo-downloaded.png";
72-
73-
// this will create or overwrite a local file in the app's documents folder
74-
var localLogoFile = documents.getFile("telerik-logo-downloaded.png");
75-
76-
// now download the file with either of the options below:
77-
firebase.storage.downloadFile({
78-
// optional, can also be passed during init() as 'storageBucket' param so we can cache it
79-
bucket: 'gs://n-plugin-test.appspot.com',
80-
// the full path of an existing file in your Firebase storage
81-
remoteFullPath: 'uploads/images/telerik-logo-uploaded.png',
82-
// option 1: a file-system module File object
83-
localFile: fs.File.fromPath(logoPath),
84-
// option 2: a full file path (ignored if 'localFile' is set)
85-
localFullPath: logoPath
86-
}).then(
87-
function (uploadedFile) {
88-
console.log("File downloaded to the requested location");
89-
},
90-
function (error) {
91-
console.log("File download error: " + error);
92-
}
93-
);
94-
```
95-
</details>
96-
97-
<details>
98-
<summary>Web API</summary>
99-
100-
#### TypeScript
101-
102-
```typescript
103-
import * as fs from "tns-core-modules/file-system";
104-
105-
const storageRef = firebaseWebApi.storage().ref();
106-
const childRef = storageRef.child("uploads/images/telerik-logo-uploaded.png");
107-
108-
// let's first determine where we'll create the file using the 'file-system' module
109-
const documents = fs.knownFolders.documents();
110-
const logoPath = documents.path + "/telerik-logo-downloaded.png";
111-
112-
childRef.download(logoPath)
113-
.then(() => console.log("The file has been downloaded"))
114-
.catch(error => console.log("Download error: " + error));
115-
```
116-
</details>
117-
118-
### getDownloadUrl
119-
If you just want to know the remote URL of a file in remote storage so you can either share it or download the file by any other means than `downloadFile` then use this method.
120-
121-
In this example we'll determine the remote URL of the previously uploaded file.
122-
123-
<details>
124-
<summary>Native API</summary>
125-
126-
```js
127-
firebase.storage.getDownloadUrl({
128-
// optional, can also be passed during init() as 'storageBucket' param so we can cache it
129-
bucket: 'gs://n-plugin-test.appspot.com',
130-
// the full path of an existing file in your Firebase storage
131-
remoteFullPath: 'uploads/images/telerik-logo-uploaded.png'
132-
}).then(
133-
function (url) {
134-
console.log("Remote URL: " + url);
135-
},
136-
function (error) {
137-
console.log("Error: " + error);
138-
}
139-
);
140-
```
141-
</details>
142-
143-
<details>
144-
<summary>Web API</summary>
145-
146-
#### TypeScript
147-
148-
```typescript
149-
const storageRef = firebaseWebApi.storage().ref();
150-
const childRef = storageRef.child("uploads/images/telerik-logo-uploaded.png");
151-
152-
childRef.getDownloadURL()
153-
.then(theUrl => console.log("Download url: " + theUrl))
154-
.catch(error => console.log("Download error: " + error));
155-
```
156-
</details>
157-
158-
### deleteFile
159-
You can pass in remote file path to delete it.
160-
161-
<details>
162-
<summary>Native API</summary>
163-
164-
```js
165-
firebase.storage.deleteFile({
166-
// optional, can also be passed during init() as 'storageBucket' param so we can cache it
167-
bucket: 'gs://n-plugin-test.appspot.com',
168-
// the full path of an existing file in your Firebase storage
169-
remoteFullPath: 'uploads/images/telerik-logo-uploaded.png'
170-
}).then(
171-
function () {
172-
console.log("File deleted.");
173-
},
174-
function (error) {
175-
console.log("File deletion Error: " + error);
176-
}
177-
);
178-
```
179-
</details>
180-
181-
<details>
182-
<summary>Web API</summary>
183-
184-
#### TypeScript
185-
186-
```typescript
187-
firebaseWebApi.storage().ref()
188-
.child("uploads/images/telerik-logo-uploaded.png")
189-
.delete()
190-
.then(() => console.log("Deleted file"))
191-
.catch(error => console.log("Error deleting file: " + error));
192-
```
193-
</details>

0 commit comments

Comments
 (0)