MatrixAI / js-encryptedfs

Encrypted Filesystem for TypeScript/JavaScript Applications
https://polykey.com
Apache License 2.0
10 stars 3 forks source link

Streams are old and legacy and should be refactored to v16 LTS #75

Open CMCDragonkai opened 1 year ago

CMCDragonkai commented 1 year ago

Specification

The streams modules are still based on readable-stream 3.6.0, and also it ported from VFS but the implementation had gone through changes that haven't been fully verified. We should upgrade the readable-stream to 4.x.x https://www.npmjs.com/package/readable-stream which is cut from nodejs v18. Then refactor our streams abstraction, and also write tests to verify all the functionality.

Of particular note is the fact that our _destroy doesn't seem to look right. There's alot of callbacks and errors that are being threaded around.

Additional context

Tasks

  1. Upgrade to 4.x.x of readable-stream
  2. Review https://nodejs.org/api/stream.html#implementing-a-writable-stream and compare with our current implementation
  3. Consider reviewing the source of readable stream for the default implementation, as the main thing is the opening and closing of our EFS file descriptors
tegefaulkes commented 7 months ago

Should we convert to webstreams here?

CMCDragonkai commented 7 months ago

We need to conserve the fs API. So we don't convert to web streams here. We just need to upgrade the fs stream readable stream library.