The Hidden Struggles of SubtleCrypto: Byte Manipulation and Memory Consumption

Hey everyone,

I wanted to discuss a concern I have regarding the utilization of SubtleCrypto for file processing. The current approach of reading files byte by byte and manipulating ciphertext is not performant and limits flexibility.

The lack of a dedicated FileReader implementation within SubtleCrypto forces developers to load the entire file into memory or implement manual chunked reading. This not only consumes excessive memory but also hampers efficient byte-level processing. It severely restricts the flexibility and performance of cryptographic operations on files.

To address this limitation, it is crucial to have a more efficient and flexible approach, such as integrating performant read/write streams or a FileReader implementation directly into SubtleCrypto. This enhancement would allow developers to process files byte by byte without convoluted workarounds or excessive memory usage.

Looking forward to your valuable insights and suggestions!