Unable to download file in expected location

Hi @nmanthena try this function. I am note sure if the Permission is required so you can also try without ii :grin:

_downloadFile = async () => {
    const { status } = await Permissions.askAsync(Permissions.CAMERA_ROLL);

//permission for camera_roll
    if (status === "granted") {
//store the cached file
      const file = await FileSystem.downloadAsync(
        link,
        FileSystem.documentDirectory + "filename.jpg"
      );

//save the image in the galery using the link of the cached file
      const assetLink = await MediaLibrary.createAssetAsync(file.uri);
      console.log(file, assetLink);
    }
  };
2 Likes