Add memory stream for linux and OSX
Avoid tmpnam