Is it possible to download/upload files and folders from FTP servers using react native? If yes, react-native-ftp package is the only one that I found which does not seem to work. Did anyone come across such a scenario?
After doing a lot of research, it seems that react-native-ftp is the only package that works, and to download, use the below code:
FTP.downloadFile(/--ftp-file-path, RNFS.ExternalStorageDirectoryPath).then((res) => {console.log("res is", res) })
FYI - RNFS.ExternalStorageDirectoryPath = This is react-native-fs to access your phone's directory and also the path where your files will be downloaded. You can view this in your phone's internal storage.
Related
I've read the new Expo docs regarding asking permissions ... And It's not clear if you're facing a lib that doesn't provide an helper for permissions !
The only thing I've noticed is in this sentence :
Most permissions are added automatically by libraries that you use in your app either with config plugins or with a package-level AndroidManifest.xml, so you won't often need to use android.permissions to add additional permissions.
Does this mean that we could still use the PermissionAndroid for some custom plugins that doesn't provide a specific requestPermissionFunction() as exo-location does ( Location.requestForegroundPermissionsAsync(); ) ?
Despite the warning in the front page of react native website ? ....
I'm trying to use the react-native-wifi-p2p lib and it need those permissions :
"android.permission.ACCESS_COARSE_LOCATION",
"android.permission.ACCESS_WIFI_STATE",
"android.permission.CHANGE_WIFI_STATE",
"android.permission.WRITE_EXTERNAL_STORAGE",
"android.permission.READ_EXTERNAL_STORAGE",
Is it even possible to use this lib with expo ?
Any help would be appreciated !
#Wodin from the expo team helped me on this one
The answer is : YES, we can use the PermissionAndroid from react native.
And add all the permissions in the app.json file at expo.android.permissions = [...] also.
Link to the original answer
I'm currently building a small website in react native just to download a file. Can someone help me get started? I just want to download one file.
I tried using RN-Fetch-BLob but it didn't work. Can someone just tell me how to download a file?
I'm using this command:
localUri='./assets/backgroundpic.jpg'
const source=localUri = await FileSystem.downloadAsync(remoteUri, FileSystem.documentDirectory + 'background');}
I'm saving a file by running the following code with Capacitor:
Filesystem.writeFile({
path: fileName,
data: content,
directory: FilesystemDirectory.Documents,
//encoding: FilesystemEncoding.UTF8
});
Now, I would like to open it (it's a pdf). However, I don't see anything in FileSystem documentation about how to achieve that? I'm missing a FileOpener function.
The goal is that it gets opened with whichever pdf app the user has in the phone.
I'm using Vuejs.
I hope that this is helpful to you, a package for capacitor to read pdf. https://www.npmjs.com/package/capacitor-pdf-viewer-plugin
I'm working on a task where I have to update a product images. Expo cache is posing a problem, when I update the product images and re-render the screen it does update my store state but doesn't show it. When I manually cleared expo cache it did work.
I have also tried using the 'Cache-Control' header, but that didn't solve the problem.
Is there a method I can call to clear expo cache ?
As far as I know the only way to clear Expo's cache is to add the -c flag to your expo start command.
Here's their page on useful commands:
expo start -c --localhost --ios
start expo server, clear cache, load only on localhost and open on iOS simulator
I don't think there's a method in their SDK that clears the cache while the app is running like you want to.
If you want to delete the cache you can use FileSystem from Expo. In that example you can delete the directory in the cache using FileSystem.deleteAsync
// Deletes whole giphy directory with all its content
export async function deleteAllGifs() {
console.log('Deleting all GIF files...');
await FileSystem.deleteAsync(gifDir);
}
when I try to download my push package it returns the push package with all the contents such as iconsets, mainfest.json, website.json, signature but while connecting it returns "Missing file in push package". Where is my mistake?
What is the file structure of your downloaded zip look like? It should only contain one directory. It should look like:
ZIP/
directory
icon.iconset (directory)
maifest.json
signature
website.json
I had a similar issue and could not figure it out. I ended up using the push_package gem
Follow this apple documentation and github repo, they include sufficient information required to create a safari push notifications.