It returns byte[] as object.
Dear @Kevinkun ,
could you show me how to declare Simplefunction (method) for my TEST extension that can directly take this result as byte[] . I can not "unwrap" that array from object 
Regards, Kuba
P.S. Yes, I've been looking into your code.
SAF How do you Create a Folder?
I would like to create a folder in Documents using SAF. I would like to do this to keep my different application's .csv files in organized locations. On the page dedicated to SAF " SAF: App Inventor implementation of Storage Access Framework"
@Narender_Kumar Narender_Kumar posted this statement:
"If anyone want to create a
empty folder after selecting the in "open Document Tree" by using "create document" .
then mimetype is following"
....
vnd.android.document/directory
There must be a little more to it. I have no problem using SAF now to save, copy, delete documents. But I still cannot create a folder.
Here is what I have tried.
The directory is the Documents folder.
But no clue how to create a directory.
Here is what I have tried.
I am not really sure what else to try, but this does not create a folder for me! Any ideas?
Thanks,
Jon
You can create dir in the document tree this way:
But if you want to create a dir which is not a direct child of document tree, then you will have to use BuildChildDocumentsUriUsingTree instead of BuildDocumentUriUsingTree.
Now Test1 will be created in Test dir.
Here Test is direct child of root Tree while Test1 is grandchild.
HOW DO MODIFY AND SAVE IN AI2 A BYTE ARRAY RECIEVED FROM Saf.ReadAsByteArray?
I'm able to read and than to write a content of a binary file using AsByteArray methods of SAF but maybe somebody knows in which way i can modify in AI2 a byte array received from SAF.ReadAsByteArray?
Any modification is converting this byte array in string and I'm receiving an error "java.lang string cannot be cast to byte[]" when i'm using SAF.WriteAsByteArray to save it (see an example below where i''m only substituting [ with the same [ - but if i pass the result of READ to WRITE without modification- everything is working).
There is no need to segment the result.
And, if you want to write file in asd then use CopyDocumentToASD block. You'll not have to worry about manual read and write.
maybe I was not able to explain my problem well.
I need to MODIFY the content of a binary file.
How can I modify a byte array variable returned by saf.ReadAsByteArray in order to be accepted by saf.WriteAsByteArray?
Unfortunately when you try to pass the modified string to WriteAsByteArray there is an error "String cannot be cast to byte".
It seems that WriteAsByteArray is expecting to receive Int8Array and not the string
Yes, it accepts byte array. 
If I try to do any change of the "result" recieved from ReadAsByteArray and path the modified string to WriteAsByteArray - I receive an error "String cannot be cast to byte".
Can you recommend any workaround to bypath this problem?
Try using normal read and write functions. They return and accept strings.
Unfortunately i'm reading and writing a file with a binary data and your ReadAsByteArray was very useful for modifying of this byte stream.
Practicaly WriteAsByteArray has to check is the input is a string and in this case convert it in Int8Array.
Cound you add this functionality to the extension with my sponsorship support?
P.s. I like your extension and i was already sponsoring the possibility to read/write files bigger than 5mb
I can think of a different way and that is to return byte array as list which you can modify. And when you will pass that modified list in WriteAsByteArray function, the list will be parsed into byte array.
It's even better because in reality i was immediately converting the string received from ReadAsByteArray to the list
Hello @Anke , have a nice day ahead!
I just want to ask where did you get this block that I encircled in the image:
I am trying to read a csv file from my app installed in android version 12. Hoping for your kind response and thank you in advance.
How can I set initialDir ? I tried with fullpath, relativepath, absolutepath without success.
Thanks for the suggestion.
It is now possible to correctly set initialDir.

Please download the aix from here:
https://github.com/vknow360/SAF/tree/beta/aix
thanks, it runs well







