Automatically migrated from Gitolite
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.
 
 
 
 

12 lines
352 B

Promise = require "bluebird"
concatStream = require "concat-stream"
buffertools = require "buffertools"
module.exports = (stream, needle) ->
# CAUTION: This buffers up in memory!
new Promise (resolve, reject) ->
stream
.pipe concatStream (result) ->
resolve buffertools.indexOf(result, needle) != -1
.on "error", (err) ->
reject err