nephelai
A helper library to upload/download files to/from a password-protected shared nextcloud folder. The link and password are read from your .env
to enable project-specific shared folders.
Because Nextcloud does not enable chunked uploads for shared folders and your files can hit the size limit, your files are uploaded in chunks if needed and reconstructed after download.
Usage
Create a .env
file in your project root.
Remember to add this file to your .gitignore
and always keep it secure to keep your secrets!
Your .env
should contain:
NEXTCLOUD_FOLDER_URI="uri_of_the_shared_folder"
NEXTCLOUD_FOLDER_PW="pw_of_the_folder"
Via CLI:
nephelai upload mytestfile.txt anextcloud/path/thatwillbecreatedifneeded/
nephelai download anextcloud/path/thatwillbecreatedifneeded/mytestfile.txt
tests/resources
├── mymatrix.npy
└── subfolder
└── testfile.txt
upload-with-fs
command:
nephelai upload-with-fs tests/resources
Which is just syntactic sugar for:
nephelai upload tests/resources tests/resources
Downloading can be done accordingly:
nephelai download tests
nephelai download tests --local-path /tmp/
/tmp/tests
└── resources
├── mymatrix.npy
└── subfolder
└── testfile.txt
Using
nephelai ls tests
tests
directory.
You can get help for each command via the --help
flag.
Via Python:
from nephelai import upload, download
upload("tests/resources", "tests/resources")
file_dl_path = "/tmp/mymatrix.npy"
download("tests/resources/mymatrix.npy",file_dl_path)
import numpy as np
mymatrix = np.load(file_dl_path)
Installation
pip install nephelai