minio-js icon indicating copy to clipboard operation
minio-js copied to clipboard

Rewrite internal asynchronous mechanism to promise and async iterator

Open trim21 opened this issue 2 years ago • 0 comments

Rewrite internal asynchronous mechanism to promise and async iterator

Currently this project use callback and stream to handle asynchronous flow control.

Now with Promise(async/await) and AsyncGenerator, we will be about to write asynchronous code like synchronous code.

stream.Readable support Readable.from(generate()), so we only need add it to change public api result, and use async generator internally.

what will changed: list*, putObject, fPutObject.

Also remove ObjectUploader, this class is used internally, so also non-breaking change

a promise async/await version of fPutObject for compare(no api change)

https://github.com/trim21/minio-js/blob/81095dc271c7be78636afdb2d67219d300422a6c/src/main/client.ts#L1281-L1306

https://github.com/minio/minio-js/blob/119b8c21041b28264f793d0adf826e4bd0060316/src/main/minio.js#L1076

trim21 avatar May 18 '23 04:05 trim21