PeelTechnologies / react-native-tcp

node's net api in react-native
MIT License
284 stars 212 forks source link

Feature suggestion `socket.writeFromFile` #111

Open eventengineering opened 4 years ago

eventengineering commented 4 years ago

Been using this library for a while and, and it's great.

However, the biggest let down when using this library comes when sending files, only this isn't a problem with this library, but instead, in how ReactNative handles files, and how slow it is reading a file into the JS only to pass it back out through the TCP library to the native code behind that bit.

As such, I'm suggesting a feature.

socket.writeFromFile(filePath[, callback]) should do as it suggests, reading from the file passed, sending in the encoding specified, and calling back the callback upon completion.

It's the only potential difference from the Node.JS Net API that this library is based off, and is unfortunately a necessity to reduce file conversion overheads present in React Native.