class Multipart::Parser

Defined in:

multipart/parser.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new #

[View source]

Instance Method Detail

def boundary : String #

[View source]
def boundary_chars : Hash(Char, Bool) #

[View source]
def callback(event, buffer = nil, start = nil, the_end = nil) #

Issues a callback.


[View source]
def data_callback(data_type, buffer, the_end, options = {} of String => String) #

Issues a data callback, The only valid options is :clear, which, if true, will reset the appropriate mark to 0, If not specified, the mark will be removed.


[View source]
def init_with_boundary(boundary) #

[View source]
def on(event, &callback) #

Registers a callback to be called when the given event occurs. Each callback is expected to take three parameters: buffer, start_index, and end_index. All of these parameters may be null, depending on the callback. Valid callbacks are: :end :header_field :header_value :header_end :headers_end :part_begin :part_data :part_end


[View source]
def write(buffer) #

Writes data to the parser. Returns the number of bytes parsed. In practise, this means that if the return value is less than the buffer size, a parse error occured.


[View source]