Skip to main content

Read GCS and local paths with the same interface, clone of

Project description


This is a standalone clone of TensorFlow's gfile, supporting both local paths, gs:// paths, and http:// paths.

Writing to a remote path will not actually perform the write incrementally, so don't write to a log file this way. By default reads and writes are streamed, set streaming=False to BlobFile to do a single copy operation per file instead.

The main function is BlobFile, a replacement for GFile. There are also a few additional functions, basename, dirname, and join, which mostly do the same thing as their os.path namesakes, only they also support gs:// paths. There are also a few extra functions:

  • cache_key - returns a cache key that can be used for the path (this is not guaranteed to change when the content changes, but should hopefully do that)
  • get_url - returns a url for a path
  • md5 - get the md5 hash for a path, for GCS this is fast, but for other backends this may be slow
  • set_log_callback - set a log callback function log(msg: string) to use instead of printing to stdout

A number of existing gfile functions are currently not implemented.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for blobfile, version 0.2.3
Filename, size File type Python version Upload date Hashes
Filename, size blobfile-0.2.3-py3-none-any.whl (12.1 kB) File type Wheel Python version py3 Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page