acuna-public / Storager

Storager is an extremely lightweight, but very high-powered library for clouds and local storages for Android

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Storager

Storager is an extremely lightweight, but very high-powered library for clouds and local storages for Android

Supported storages

  • Google Drive
  • Dropbox
  • Яндекс.Диск
  • SFTP
  • SDCard

Advantages

  • Simple to use
  • Lightweight
  • Doesn't use any side libraries, only native Java HttpURLConnection to access the clouds services REST APIs

Install

Add the following dependency in dependencies section of your module build.gradle file:

api 'pro.acuna:storager:2.3'

Usage

Storage storage = new Storage ();

JSONObject data = new JSONObject (), storagesData = new JSONObject ();

data.put ("key", "DROPBOX_KEY");
data.put ("secret", "DROPBOX_SECRET");
data.put ("redirect_url", "DROPBOX_REDIRECT_URL");

storagesData.put ("dropbox", data);

data = new JSONObject ();

data.put ("key", "YADISK_KEY");
data.put ("secret", "YADISK_SECRET");
data.put ("redirect_url", "YADISK_REDIRECT_URL");

storagesData.put ("yadisk", data);

storage.init ("yadisk", storagesData);

Set storage auth data

String storage.read (String remoteFile)

Read file from storage to string

List<Item> storage.list (String remoteDir)

Get list of items (files) of storage directory

boolean storage.isDir (String remoteFile)

Check if it is a directory

boolean storage.isExists (String remoteFile)

Check if file or directory exists in storage

void storage.makeDir (String remoteDir)

Create a directory in storage. Use slashes to create a subfolders (dir1/dir2)

void storage.write (Object|InputStream stream, String remoteFile)

Write a stringified Object or InputStream to file in storage

void storage.copy (File localFile, String remoteFile)
void storage.copy (File localFile, String remoteFile, boolean force)

Copy file or directory in storage

void storage.copy (URL localFile, String remoteFile)
void storage.copy (URL localFile, String remoteFile, boolean force)

Get file from URL and put it in storage

void storage.copy (String remoteFile, File localFile)

Copy file from storage to local filesystem (download)

void storage.copy (String remoteFile, OutputStream stream)

Copy file from storage to OutputStream

void storage.copy (String remoteSrcFile, String remoteDestFile)

Copy one file to another in current storage

void storage.delete (String remoteFile)

Delete file or folder from storage

About

Storager is an extremely lightweight, but very high-powered library for clouds and local storages for Android


Languages

Language:Java 100.0%