GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Mango::GridFS::Writer(3) User Contributed Perl Documentation Mango::GridFS::Writer(3)

Mango::GridFS::Writer - GridFS writer

  use Mango::GridFS::Writer;

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

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

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

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

Chunk size in bytes, defaults to 261120 (255KB).

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

Content type of file.

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

Name of file.

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

Mango::GridFS object this writer belongs to.

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

Additional information.

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

  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;

  my $success = $writer->is_closed;

Check if file has been closed.

  $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;

Mango, Mojolicious::Guides, <http://mojolicio.us>.
2018-03-17 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.