SOS. Expo file system doesn't allow me to do anything if the file doesn't exist. I want to create a text!

I want to store a json data locally for reordering. But the expo file system oesn’t allow me to do anything if the file doesn’t exist. THis doesn’t make any sense at all. I need to create it, but the doc doesn’t tell me how. SOS/ I say expo doesn’t make sense. How can we write and edit a json or text if expo file doesn’t see the file??/

Hi @jonathansum

That restriction only applies “when you’re using SAF URI”

Hi. thx for answering.
How do I create and write a file without using SAF?

Something like this:

import * as FileSystem from 'expo-file-system';

async function something() {
// ...
  const fileUri = FileSystem.documentDirectory + "yourFile.json";
  await FileSystem.writeAsStringAsync(fileUri, "file contents");
}

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.