Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

pretty.js 837B

1234567891011121314151617181920212223242526
  1. var inspect = require('util').inspect
  2. var es = require('event-stream') //load event-stream
  3. var split = require('../')
  4. if(!module.parent) {
  5. es.pipe( //pipe joins streams together
  6. process.openStdin(), //open stdin
  7. split(), //split stream to break on newlines
  8. es.map(function (data, callback) {//turn this async function into a stream
  9. var j
  10. try {
  11. j = JSON.parse(data) //try to parse input into json
  12. } catch (err) {
  13. return callback(null, data) //if it fails just pass it anyway
  14. }
  15. callback(null, inspect(j)) //render it nicely
  16. }),
  17. process.stdout // pipe it to stdout !
  18. )
  19. }
  20. // run this
  21. //
  22. // curl -sS registry.npmjs.org/event-stream | node pretty.js
  23. //