Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

What is this chunked upload ? #380

Answered by jnsougata
AyushSehrawat asked this question in Help
Discussion options

You must be logged in to vote

Yes you got it right!
Here's an example how I implemented it my async deta library! the quality of the code is a bit nasty...though

    async def _push_file(self, drive_name: str, remote_path: str, path: PathLike):

        if isinstance(path, str):
            file = open(path, 'rb')
        elif isinstance(path, bytes):
            file = io.BytesIO(path)
        else:
            raise ValueError('path must be a string or bytes')

        chunks = file.read()

        if not len(chunks) > self.__SINGLE_REQ_UPLOAD_SIZE:
            ep = self.__drive_root + drive_name + '/files?name=' + quote_plus(remote_path)
            resp = await self.__session.post(ep, headers=self.__drive_headers, d…

Replies: 1 comment 8 replies

Comment options

You must be logged in to vote
8 replies
@jnsougata
Comment options

@AyushSehrawat
Comment options

@jnsougata
Comment options

@AyushSehrawat
Comment options

@thomasmuus
Comment options

Answer selected by AyushSehrawat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants