Comments (5)
@Mannshoch : Can you provide an estimate on the file size before your app runs out of RAM?
from pysmb.
I have planned to backup a ~16GB ZIP form a WebDAV with as cron job once a month onto a NAS. My Router has 2GB RAM (around 1.4GB is unused). It is possible to ask WebDAV (webdavclient3) for the file size.
from pysmb.
The issue might be that your app is trying to read the entire zip into memory before uploading to your NAS.
If you can read your zip file in smaller chunks from your WebDAV server, you can use pysmb's storeFileFromOffset to upload each chunk of data at the last offset.
from pysmb.
that's my current code:
for filename in webdav_fs.ls(webdav_pfad, detail=False):
webdav_file_path = os.path.join(filename)
smb_file_path = os.path.join(smb_path, filename)
file_size = webdav_fs.info(webdav_file_path)['size']
offset = 0
chunk_size = 8 * 1024 # 8KB
f = io.BytesIO()
webdav_client.download_fileobj(webdav_file_path, f)
f.seek(0)
while True:
chunk = f.read(chunk_size)
if not chunk:
break
smb_conn.storeFileFromOffset(smb_service_name, smb_file_path, f, offset=offset)
offset += len(chunk)
from pysmb.
webdav_client.download_fileobj(webdav_file_path, f)
This line will download the entire WebDAV file into the memory.
Please check if your client can download the file in chunks from the remote WebDAV server.
from pysmb.
Related Issues (20)
- Can't get file list on DFS shared folder HOT 6
- listPath fails with "STATUS_ACCESS_DENIED" due to too broad access mask HOT 2
- pysmb-provided MD4 implementation for Python3 is broken HOT 6
- ThreadPoolExecutor storeFile HOT 1
- Using same code in Windows and Linux to access remote paths HOT 2
- Problem performing listPath using SMB1 with version 1.2.8 (similar to issue #195)
- Server does not support any of the pysmb dialects HOT 2
- When are compressed transfers supported?
- Unable to install the latest version of pysmb(1.2.9) HOT 7
- TypeError: can't concat str to bytes HOT 2
- How to improve transfer speed
- Server does not support any of the pysmb dialects. Please email pysmb to add in support for your OS HOT 1
- Copy a file using pysmb from windows to linux HOT 8
- Don't connect to SMBv2 server HOT 5
- Provide wheel distributions
- Request to Update Documentation for SMBConnection Class HOT 4
- storeFile raise SMBTimeout exception on files > 1k HOT 2
- Compatibility Issue with Unraid SMB Server: Unable to Negotiate Supported SMB Dialect
- Hash mis-match when installing pysmb HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pysmb.