1Mango::GridFS::Writer(3U)ser Contributed Perl DocumentatiMoanngo::GridFS::Writer(3)
2
3
4

NAME

6       Mango::GridFS::Writer - GridFS writer
7

SYNOPSIS

9         use Mango::GridFS::Writer;
10
11         my $writer = Mango::GridFS::Writer->new(gridfs => $gridfs);
12

DESCRIPTION

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

ATTRIBUTES

17       Mango::GridFS::Writer implements the following attributes.
18
19   chunk_size
20         my $size = $writer->chunk_size;
21         $writer  = $writer->chunk_size(1024);
22
23       Chunk size in bytes, defaults to 261120 (255KB).
24
25   content_type
26         my $type = $writer->content_type;
27         $writer  = $writer->content_type('text/plain');
28
29       Content type of file.
30
31   filename
32         my $name = $writer->filename;
33         $writer  = $writer->filename('foo.txt');
34
35       Name of file.
36
37   gridfs
38         my $gridfs = $writer->gridfs;
39         $writer    = $writer->gridfs(Mango::GridFS->new);
40
41       Mango::GridFS object this writer belongs to.
42
43   metadata
44         my $data = $writer->metadata;
45         $writer  = $writer->metadata({foo => 'bar'});
46
47       Additional information.
48

METHODS

50       Mango::GridFS::Writer inherits all methods from Mojo::Base and
51       implements the following new ones.
52
53   close
54         my $oid = $writer->close;
55
56       Close file. You can also append a callback to perform operation non-
57       blocking.
58
59         $writer->close(sub {
60           my ($writer, $err, $oid) = @_;
61           ...
62         });
63         Mojo::IOLoop->start unless Mojo::IOLoop->is_running;
64
65   is_closed
66         my $success = $writer->is_closed;
67
68       Check if file has been closed.
69
70   write
71         $writer = $writer->write('hello world!');
72
73       Write chunk. You can also append a callback to perform operation non-
74       blocking.
75
76         $writer->write('hello world!' => sub {
77           my ($writer, $err) = @_;
78           ...
79         });
80         Mojo::IOLoop->start unless Mojo::IOLoop->is_running;
81

SEE ALSO

83       Mango, Mojolicious::Guides, <http://mojolicio.us>.
84
85
86
87perl v5.28.0                      2018-03-17          Mango::GridFS::Writer(3)
Impressum