Android Question [Solved] Firebase Storage - Create txt file directly to the cloud

trepdas

Active Member
Licensed User
Hello b4x good people,

right now, Our app is creating a txt file in the dir.internal folder.
(this file contains a short string) and then uploads it to firebase storage. (successfully, finally....)

Is it possible to replace this procedure by directly create the txt file in the storage?
(something like upload a stream (string) as 1.txt ?)

and if so, how to?


and another question,...

can I use a similar method using the ftp lib with a remote server (NOT firebase storage but a simple remote unix server)

can the 1.txt file be created directly instead of uploading it from the internal dir?

B4X:
FTP.UploadFile(File.DirInternal, "1.txt", True, NewPath)


???
šŸ¤”



TIA
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
can the 1.txt file be created directly instead of uploading it from the internal dir?
Not that i know of. Save the file to DirInternal, upload it and delete the File from DirInternal it after uploading
 
Upvote 0

trepdas

Active Member
Licensed User
Dim b() As Byte = NewPath.GetBytes("utf8")
Dim in As InputStream
in.InitializeFromBytesArray(b, 0, b.Length)
FirebaseStorage.UploadStream(in, ServerPath)

Seriously ???
COOL !
can't wait to test this at home. (few hours)


THX Erel !!
 
Upvote 0

trepdas

Active Member
Licensed User
just in case someone would need an example on how to download a stream into string ...

B4X:
Dim FBFilePath As String = "/public/test.txt"
Dim b() As Byte
Dim ot As OutputStream
ot.InitializeToBytesArray(0)
Dim TmpStr As String

storage.DownloadStream (FBFilePath,ot)
b=ot.ToBytesArray
Tmpstr=BytesToString(b,0,b.Length,"UTF-8")
 
Upvote 0
Top