functionland / fula-archived

Client-server stack for Web3! Turn your Raspberry Pi to a BAS server in minutes and enjoy the freedom of decentralized Web with a superior user experience!
https://fx.land
MIT License
4 stars 0 forks source link

File protocol `sendFile` method #216

Open mehdibalouchi opened 2 years ago

mehdibalouchi commented 2 years ago

Opinion: The sendFile method in the File protocol should be removed and the client should decide about it.

Right now, the fula-client imports the sendFile method from the @functionland/file-protocol and simply passes the filename to it. It is the file protocol that decides how to read the specified filename into a buffer. In the file protocol, there is streamFile method that takes an AsyncIterable as the input and sends the data over the stream. This is all that the file protocol needs to do.