Sha256: dfa17c339ef8ce14d4bf636484c9bf5a03d6f5080b1255c81f4b8539f09c264e
Contents?: true
Size: 698 Bytes
Versions: 38
Compression:
Stored size: 698 Bytes
Contents
class Puppeteer::ProtocolStreamReader def initialize(client:, handle:) @client = client @handle = handle end # @returns [Enumerable<String>] def read_as_chunks Enumerator.new do |out| io_read { |data| out << data } io_close end end private def io_read(&block) eof = false until eof response = @client.send_message('IO.read', handle: @handle) eof = response['eof'] data = if response['base64Encoded'] Base64.decode64(response['data']) else response['data'] end block.call(data) end end private def io_close @client.send_message('IO.close', handle: @handle) end end
Version data entries
38 entries across 38 versions & 1 rubygems