Updated build.js for latest Node version

I updated the build tool to work with the latest Node.js streams and fs libraries.