hkg*_*ile 5 android react-native expo
我正在尝试将字符串写入文件,如下所示:
filename = await FileSystem.documentDirectory + tempname + ".txt";
await FileSystem.writeAsStringAsync(filename, "hello world", { encoding: FileSystem.EncodingTypes.UTF8 });
Run Code Online (Sandbox Code Playgroud)
但没有找到文件,我需要用它来创建一个文件
await MediaLibrary.createAssetAsync(`${FileSystem.documentDirectory}${tempname}.txt`);
Run Code Online (Sandbox Code Playgroud)
之后,该文件出现在 document/DCIM/myfile.txt 中。但我知道使用 createAssetAsync 会创建一个附加文件。
我想知道 writeAsStringAsync 将写入的实际文件在哪里?我使用 getInfoAsync 来显示文件位于
file:///data/user/0/host.exp.exponent/files/ExperienceData/%2540hkvega01%252Fstocktake-file-builder/456-2019-2-12.txt"
Run Code Online (Sandbox Code Playgroud)
但我没有找到这条路。
| 归档时间: |
|
| 查看次数: |
2084 次 |
| 最近记录: |