Runkit
Runkit
home page
user forum
new notebook
support & documentation
log in
sign up
new notebook
documentation & support
Sign In
Sign Up
sequoia's notebooks
Stream a String
-
/sequoia/stream-string
Last edited 7 years ago
const Stream = require('stream'); const inputStream = new Stream.Readable; inputStream._read = function noop() {}; inputStream.push('foo|bar'); inputStream.push('foo|bar'); inputStream.pipe(process.stdout); inputStream.push('foo|bar'); inputStream.push('foo|bar'); inputStream.push('foo|bar'); console.log('yo'); null;
Running a series of promises w/o exiting on reject
-
/sequoia/promise-queue
Last edited 7 years ago
Promise = require('bluebird'); ids = [ 1, 3, 4, 5 ]; function processTask(id){ if(id % 2 == 0){ console.error(`id ${id} failed :(`); return Promise.reject(id); } console.log(`id ${id} processed!`); return Promise.resolve(id); } var queue = ids.reduce(function promiseReducer(queue, id){ const runtask = () => processTask(id); const logandruntask = (e) => { queue.errors.push(e); return runtask(); } return { promise: queue.promise.then(runtask, logandruntask), errors: queue.errors }; }, {errors : [], promise: Promise.resolve()}); queue.promise.then(function(){ console.log(`completed with ${queue.errors.length} errors`); });
express tonicdev test
-
/sequoia/test-express
Last edited 7 years ago
Here's how to run express demos from Tonicdev: