MCPcopy Index your code
hub / github.com/NativeScript/firebase / uploadText

Method uploadText

apps/demo/src/plugin-demos/firebase-storage.ts:22–49  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

20 }
21
22 uploadText() {
23 if (!this.textToUpload?.trim?.().length) {
24 return;
25 }
26 const metadata = new Metadata();
27 metadata.contentType = 'text/plain';
28 this.storage
29 .ref()
30 .child(`text_files/${this.textToUploadFileName ? this.textToUploadFileName : Date.now()}.txt`)
31 .putString(this.textToUpload, null, metadata)
32 .on(TaskEvent.STATE_CHANGED, {
33 complete() {
34 console.info('uploadText', 'completed');
35 },
36 error(err) {
37 console.error('uploadText', 'error', err);
38 },
39 next(snapshot) {
40 console.info('uploadText', 'next', 'state', snapshot.state, snapshot.error);
41 if (snapshot.totalBytes) {
42 console.log('uploadFile', 'next', 'progress %', snapshot.bytesTransferred / snapshot.totalBytes ?? 0 * 100);
43 }
44 if (snapshot.error) {
45 console.error('uploadText', 'next', snapshot.error);
46 }
47 },
48 });
49 }
50
51 uploadFile() {
52 const file = File.fromPath(

Callers

nothing calls this directly

Calls 5

onMethod · 0.65
putStringMethod · 0.65
childMethod · 0.65
refMethod · 0.65
nowMethod · 0.45

Tested by

no test coverage detected