|
NAMEMango::GridFS::Writer - GridFS writerSYNOPSISuse Mango::GridFS::Writer; my $writer = Mango::GridFS::Writer->new(gridfs => $gridfs); DESCRIPTIONMango::GridFS::Writer writes files to GridFS.ATTRIBUTESMango::GridFS::Writer implements the following attributes.chunk_sizemy $size = $writer->chunk_size; $writer = $writer->chunk_size(1024); Chunk size in bytes, defaults to 261120 (255KB). content_typemy $type = $writer->content_type; $writer = $writer->content_type('text/plain'); Content type of file. filenamemy $name = $writer->filename; $writer = $writer->filename('foo.txt'); Name of file. gridfsmy $gridfs = $writer->gridfs; $writer = $writer->gridfs(Mango::GridFS->new); Mango::GridFS object this writer belongs to. metadatamy $data = $writer->metadata; $writer = $writer->metadata({foo => 'bar'}); Additional information. METHODSMango::GridFS::Writer inherits all methods from Mojo::Base and implements the following new ones.closemy $oid = $writer->close; Close file. You can also append a callback to perform operation non-blocking. $writer->close(sub { my ($writer, $err, $oid) = @_; ... }); Mojo::IOLoop->start unless Mojo::IOLoop->is_running; is_closedmy $success = $writer->is_closed; Check if file has been closed. write$writer = $writer->write('hello world!'); Write chunk. You can also append a callback to perform operation non-blocking. $writer->write('hello world!' => sub { my ($writer, $err) = @_; ... }); Mojo::IOLoop->start unless Mojo::IOLoop->is_running; SEE ALSOMango, Mojolicious::Guides, <http://mojolicio.us>.
Visit the GSP FreeBSD Man Page Interface. |