1.1.6 • Published 2 years ago

react-native-webdav v1.1.6

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

react-native-webdav

A sardine-android wrapper for react native to access files with webdav.

IMPORTANT

  • This package is only for Android apps and doesn't work with Expo. No plan to support ios from my side. Feel free to pull request.

  • This package has only been tested for RN >=0.64.0

Usage (Android)

npm install react-native-webdav --save

Examples

List files and folders

import RNWebdav from "react-native-webdav";

//URL points to the folder
RNWebdav.list(USERNAME, PASSWORD, URL)
  .then((res) => {
    console.log(res); //folders and files in a array sequelized to string, eg: [/dav/, /dav/KoodoReader1/, /dav/KoodoReader/, /dav/KoodoReader2/]
  })
  .catch((err) => {
    console.log(err);
  });

Check if file or folder exsits

import RNWebdav from "react-native-webdav";

//URL points to the folder or file
RNWebdav.exsits(USERNAME, PASSWORD, URL)
  .then((res) => {
    console.log(res); //true if exists
  })
  .catch((err) => {
    console.log(err);
  });

Move file

import RNWebdav from "react-native-webdav";

//URL points to the file
RNWebdav.move(USERNAME, PASSWORD, SOURCE_URL, DESTINATION_URL, IS_OVERWRITE) //Url needs to contain the file name and extension
  .then((res) => {
    console.log(res); //true if success
  })
  .catch((err) => {
    console.log(err);
  });

Copy file

import RNWebdav from "react-native-webdav";

//URL points to the file
RNWebdav.copy(USERNAME, PASSWORD, SOURCE_URL, DESTINATION_URL, IS_OVERWRITE) //Url needs to contain the file name and extension
  .then((res) => {
    console.log(res); //true if success
  })
  .catch((err) => {
    console.log(err);
  });

Create folder

import RNWebdav from "react-native-webdav";

//URL points to the folder
RNWebdav.createDirectory(USERNAME, PASSWORD, URL)
  .then((res) => {
    console.log(res); //true if success
  })
  .catch((err) => {
    console.log(err);
  });

Download file

import RNWebdav from "react-native-webdav";

RNWebdav.download(USERNAME, PASSWORD, URL_TO_FILE, DEST_PATH_FOR_FILE) //Url and path needs to contain the file name and extension
  .then((res) => {
    console.log(res); //true if success
  })
  .catch((err) => {
    console.log(err);
  });

Upload file

import RNWebdav from "react-native-webdav";

RNWebdav.upload(USERNAME, PASSWORD, DEST_URL_FOR_FILE, SOURCE_PATH_TO_FILE) //Url and path needs to contain the file name and extension
  .then((res) => {
    console.log(res); //true if success
  })
  .catch((err) => {
    console.log(err);
  });

License

This project is licensed under MIT

1.1.6

2 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.5

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago