Coder Social home page Coder Social logo

easy_minio's Introduction

This is a wrapper of minio-py.

This package is under active development. If you have any questions, please feel free to open an issue.

Features

easy-minio supports following features:

  1. Unix like path to locate objects, e.g. "bucket/p1/p2/p3/file", instead of get(bucket, p1/p2/p3/file) in minio-py.
  2. Python native cache feature, without setup minio gateway.
  3. Easy to use open(path, mode) operation to modify file directly.
  4. Parallel objects downloading based on multiprocessing.
  5. Upload or download multiple objects in one function call.

Install

python -m pip install git+git://github.com/ThyrixYang/easy_minio.git@main

Usage

There are two approaches to set your accounts:

  1. Setup environment variables, MINIO_ACCESS_KEY, MINIO_SECRET_KEY, MINIO_ENDPOINT.
  2. Pass to MinioClient, if keys are provided in the arguments, the environment variables will be ignored.
  3. You need to setup a cache_path using EASY_MINIO_CACHE environment variable or cache_path argument.
from easy_minio import MinioClient
import pickle

mc = MinioClient() # If environment variables have been set.
mc = MinioClient(endpoint=..., access_key=..., secret_key=..., cache_path=...) # set arguments in constructor.

file_path = "bucket_name/dir1/dir2/test.txt"

with mc.open(file_path, "w") as f:
    f.write("test string")

with mc.open(file_path, "r") as f:
    f.readlines()

# The file can be operated as usual, thus we can also use pickle
with mc.open(file_path, "wb") as f:
    pickle.dump("test", f)

# Check if a object exists
res = mc.object_exists(file_path)

easy_minio's People

Contributors

thyrixyang avatar

Stargazers

cgoe avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.