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.

helper.js 849B

123456789101112131415161718192021222324252627282930313233343536373839
  1. var _Readable = require('readable-stream/readable');
  2. var _Writable = require('readable-stream/writable');
  3. var util = require('util');
  4. module.exports = {
  5. DummyReadable: DummyReadable,
  6. DummyWritable: DummyWritable
  7. };
  8. function DummyReadable(strings) {
  9. _Readable.call(this);
  10. this.strings = strings;
  11. this.emit('readable');
  12. }
  13. util.inherits(DummyReadable, _Readable);
  14. DummyReadable.prototype._read = function _read(n) {
  15. if (this.strings.length) {
  16. this.push(new Buffer(this.strings.shift()));
  17. } else {
  18. this.push(null);
  19. }
  20. };
  21. function DummyWritable(strings) {
  22. _Writable.call(this);
  23. this.strings = strings;
  24. this.emit('writable');
  25. }
  26. util.inherits(DummyWritable, _Writable);
  27. DummyWritable.prototype._write = function _write(chunk, encoding, callback) {
  28. this.strings.push(chunk.toString());
  29. if (callback) callback();
  30. };