Front end of the Slack clone application.

12345678910111213141516171819202122232425
  1. var tar = require("../tar.js")
  2. , fstream = require("fstream")
  3. , fs = require("fs")
  4. var dirDest = fs.createWriteStream('dir.tar')
  5. function onError(err) {
  6. console.error('An error occurred:', err)
  7. }
  8. function onEnd() {
  9. console.log('Packed!')
  10. }
  11. var packer = tar.Pack({ noProprietary: true })
  12. .on('error', onError)
  13. .on('end', onEnd);
  14. // This must be a "directory"
  15. fstream.Reader({ path: __dirname, type: "Directory" })
  16. .on('error', onError)
  17. .pipe(packer)
  18. .pipe(dirDest)