GNU.WIKI: The GNU/Linux Knowledge Base

  [HOME] [PHP Manual] [HowTo] [ABS] [MAN1] [MAN2] [MAN3] [MAN4] [MAN5] [MAN6] [MAN7] [MAN8] [MAN9]

  [0-9] [Aa] [Bb] [Cc] [Dd] [Ee] [Ff] [Gg] [Hh] [Ii] [Jj] [Kk] [Ll] [Mm] [Nn] [Oo] [Pp] [Qq] [Rr] [Ss] [Tt] [Uu] [Vv] [Ww] [Xx] [Yy] [Zz]


NAME

       Mango::GridFS::Writer - GridFS writer

SYNOPSIS

         use Mango::GridFS::Writer;

         my $writer = Mango::GridFS::Writer->new(gridfs => $gridfs);

DESCRIPTION

       Mango::GridFS::Writer writes files to GridFS.

ATTRIBUTES

       Mango::GridFS::Writer implements the following attributes.

   chunk_size
         my $size = $writer->chunk_size;
         $writer  = $writer->chunk_size(1024);

       Chunk size in bytes, defaults to 262144.

   content_type
         my $type = $writer->content_type;
         $writer  = $writer->content_type('text/plain');

       Content type of file.

   filename
         my $name = $writer->filename;
         $writer  = $writer->filename('foo.txt');

       Name of file.

   gridfs
         my $gridfs = $writer->gridfs;
         $writer    = $writer->gridfs(Mango::GridFS->new);

       Mango::GridFS object this writer belongs to.

   metadata
         my $data = $writer->metadata;
         $writer  = $writer->metadata({foo => 'bar'});

       Additional information.

METHODS

       Mango::GridFS::Writer inherits all methods from Mojo::Base and
       implements the following new ones.

   close
         my $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_closed
         my $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 ALSO

       Mango, Mojolicious::Guides, <http://mojolicio.us>.



  All copyrights belong to their respective owners. Other content (c) 2014-2018, GNU.WIKI. Please report site errors to webmaster@gnu.wiki.
Page load time: 0.095 seconds. Last modified: November 04 2018 12:49:43.