Xuanwo commented on code in PR #3619:
URL: 
https://github.com/apache/incubator-opendal/pull/3619#discussion_r1405685638


##########
bindings/nodejs/tests/utils.mjs:
##########
@@ -54,3 +54,23 @@ export function loadConfigFromEnv(scheme) {
       .map(([key, value]) => [key.replace(prefix, ''), value]),
   )
 }
+
+// A readable stream that reads from a buffer
+export class BufferStream extends Readable {

Review Comment:
   We shouldn't introduce a non-extendable public API like this. We should 
allow users to configure the buffer while creating `Reader` and `Writer`.
   
   For example:
   
   ```node
   let  = Writable.from(op.writerSync({ buffer : 4*1024*1024}))
   ```



##########
bindings/nodejs/index.js:
##########
@@ -19,9 +19,59 @@
 
 /// <reference types="node" />
 
+const { Writable, Readable } = require('node:stream')
+
+class ReaderStream extends Readable {

Review Comment:
   We need to give more consideration to this API.
   
   ## For naming
   
   Do we still `Reader` and `Writer` for users? How about rename to `RawReader` 
/ `RawWriter` (or other things) and expose `class Reader extends Readable` and 
`class Writer extends Writable`?
   
   In this, our users can write code like:
   
   ```js
   let stream = Readable.from(op.readerSync());
   ```
   
   or 
   
   ```js
   op.readerSync().pipe(abc);
   ```
   
   ## For async
   
   Do `Readable` and `Writable` have async support? How could we support them?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to