MCPcopy Create free account
hub / github.com/pyload/pyload / fsbsize

Function fsbsize

module/plugins/internal/misc.py:314–334  ·  view source on GitHub ↗

Get optimal file system buffer size (in bytes) for I/O calls

(path)

Source from the content-addressed store, hash-verified

312
313
314def fsbsize(path):
315 """
316 Get optimal file system buffer size (in bytes) for I/O calls
317 """
318 path = fs_encode(path)
319
320 if os.name == "nt":
321 import ctypes
322
323 drive = "%s\\" % os.path.splitdrive(path)[0]
324 cluster_sectors, sector_size = ctypes.c_longlong(0)
325
326 ctypes.windll.kernel32.GetDiskFreeSpaceW(ctypes.c_wchar_p(drive),
327 ctypes.pointer(cluster_sectors),
328 ctypes.pointer(sector_size),
329 None,
330 None)
331 return cluster_sectors * sector_size
332
333 else:
334 return os.statvfs(path).f_frsize
335
336
337def uniqify(seq):

Callers 1

compute_checksumFunction · 0.85

Calls 1

fs_encodeFunction · 0.70

Tested by

no test coverage detected