Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2733)

Unified Diff: tools/vulcanize/node_modules/vulcanize/node_modules/cheerio/node_modules/htmlparser2/node_modules/readable-stream/examples/CAPSLOCKTYPER.JS

Issue 125733002: Add vulcanize to tools. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/vulcanize/node_modules/vulcanize/node_modules/cheerio/node_modules/htmlparser2/node_modules/readable-stream/examples/CAPSLOCKTYPER.JS
diff --git a/tools/vulcanize/node_modules/vulcanize/node_modules/cheerio/node_modules/htmlparser2/node_modules/readable-stream/examples/CAPSLOCKTYPER.JS b/tools/vulcanize/node_modules/vulcanize/node_modules/cheerio/node_modules/htmlparser2/node_modules/readable-stream/examples/CAPSLOCKTYPER.JS
new file mode 100644
index 0000000000000000000000000000000000000000..205a42564b5773e0378c066d71b7da34c7b85af7
--- /dev/null
+++ b/tools/vulcanize/node_modules/vulcanize/node_modules/cheerio/node_modules/htmlparser2/node_modules/readable-stream/examples/CAPSLOCKTYPER.JS
@@ -0,0 +1,32 @@
+var Transform = require('../transform');
+var inherits = require('util').inherits;
+
+// subclass
+function MyStream () {
+ Transform.call(this, {
+ lowWaterMark: 0,
+ encoding: 'utf8'
+ });
+}
+inherits(MyStream, Transform);
+
+MyStream.prototype._transform = function (chunk, outputFn, callback) {
+ outputFn(new Buffer(String(chunk).toUpperCase()));
+ callback();
+};
+
+// use it!
+var s = new MyStream();
+process.stdin.resume();
+process.stdin.pipe(s).pipe(process.stdout);
+if (process.stdin.setRawMode)
+ process.stdin.setRawMode(true);
+process.stdin.on('data', function (c) {
+ c = c.toString();
+ if (c === '\u0003' || c === '\u0004') {
+ process.stdin.pause();
+ s.end();
+ }
+ if (c === '\r')
+ process.stdout.write('\n');
+});

Powered by Google App Engine
This is Rietveld 408576698