Ranged read file access abstraction.
Project description
Net-file ranged read file access abstraction library
net-file allows you to access files by URL the same way for different types of storage:
- local files
- files served by http(s) servers like Nginx
- files on SFTP
- ...
Second major feature of net-file is ranged access. So you can download only part of file starting from arbitrary position.
API
open_url(
url: str, # File URL. For local file use file:///absolute/file/path
start_bytes: int = None, # For ranged access - the beginning of the range
length: int = None # For ranged access - range length
) -> NetFile
Opens URL returning NetFile
object. To read from file use context manager
or open()
/ close()
methods pair of NetFile
object:
with open_url(
url='http://test.domain/example.mp4',
start_bytes=10000,
length=20000,
) as open_file:
content = open_file.read()
while content:
content = open_file.read()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
net-file-1.1.6.tar.gz
(4.6 kB
view hashes)