3 ms·
Use io.Copy to copy from the file to os.Stdout. no need to read the whole thing into memory.
by NateDad 12y ago
Use io.Copy to copy from the file to os.Stdout. no need to read the whole thing into memory.
- barsonme 12y agoHadn't even thought of that! Nice catch. It's even shorter: https://gist.github.com/EricLagerg/c3ccf96f6ed90d8b4557 https://gist.github.com/EricLagerg/c3ccf96f6ed90d8b4557
- EugeneOZ 12y agoStop it please, or PHP will win this race easily. With just 1 line of code. And it doesn't mean anything.