kuatsu/react-native-cloud-storage

Creating Directory and save files in that directory

Closed this issue · 2 comments

Describe the bug
Cannot create directory iCloud

Steps to reproduce
Try using RNClousdStorage.writeFile to create a directory,

await RNCloudStorage.writeFile("backupFolder", "", scope);

It should create a directory.
Then, try to save a file with directory

await RNCloudStorage.writeFile("backupFolder/backupFile.txt", "content", scope);

I get the following error when logging the error in console:

[Error: Error writing file backupFolder/backupFile.txt]

How can I save files in a directory in iCloud?

Environment:

  • Device: [ Mobile]
  • OS: [iOS]

This is indeed not supported yet. It's only possible to create files within directories that already exist for now.

Creating directories is planned for the next release (which should land on Tuesday).

This is now possible in version 0.6.0. Use the mkdir method to create new directories. You can check if a directory already exists using the exists or stat methods.