-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Labels
Description
Currently I am downloading encrypted payload and its stored on storage as a file. To display the data in the app
After the download I have to read the whole file that was just written to storage back into memory (in chunks or as a whole), decrypt it, save it back to storage and removing the encrypted version of the file.
I wonder now if the library could allow the user to supply a file writing interceptor that this lib delegates the file writing to like this:
await BlobCourier
.onDownload({
blockSize: 16384 * 5,
transcode: (input: ArrayBuffer, last: boolean):Promise<ArrayBuffer> {
last ? return aes.finish(input) : aes.decrypt(input)
}
}
).fetch("https://example.org/encrypted.enc")Some starting point maybe?
https://medium.com/swlh/okhttp-interceptors-with-retrofit-2dcc322cc3f3
It would be crucial to operate on streams rather than having the whole response in memory.
sayem314