Delete unused file write.ts

This commit is contained in:
Brandon Presley 2024-02-11 22:10:05 +13:00
parent 47bff2d07c
commit 5e420ec9c4
1 changed files with 0 additions and 21 deletions

View File

@ -1,21 +0,0 @@
import { PermissionsAndroid, Platform } from "react-native";
import { Dirs, FileSystem } from "react-native-file-access";
import { toast } from "./toast";
export const write = async (name: string, data: string) => {
const filePath = `${Dirs.DocumentDir}/${name}`;
const permission = async () => {
if (Platform.OS !== "android") return true;
const granted = await PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE
);
return granted === PermissionsAndroid.RESULTS.GRANTED;
};
const granted = await permission();
if (!granted) return;
await FileSystem.writeFile(filePath, data);
if (Platform.OS === "android") {
await FileSystem.cpExternal(filePath, name, "downloads");
}
toast(`Downloaded ${name}`);
};