1Mango::GridFS::Reader(3U)ser Contributed Perl DocumentatiMoanngo::GridFS::Reader(3)
2
3
4
6 Mango::GridFS::Reader - GridFS reader
7
9 use Mango::GridFS::Reader;
10
11 my $reader = Mango::GridFS::Reader->new(gridfs => $gridfs);
12
14 Mango::GridFS::Reader reads files from GridFS.
15
17 Mango::GridFS::Reader implements the following attributes.
18
19 gridfs
20 my $gridfs = $reader->gridfs;
21 $reader = $reader->gridfs(Mango::GridFS->new);
22
23 Mango::GridFS object this reader belongs to.
24
26 Mango::GridFS::Reader inherits all methods from Mojo::Base and
27 implements the following new ones.
28
29 chunk_size
30 my $size = $reader->chunk_size;
31
32 Chunk size in bytes.
33
34 content_type
35 my $type = $reader->content_type;
36
37 Content type of file.
38
39 filename
40 my $name = $reader->filename;
41
42 Name of file.
43
44 md5
45 my $checksum = $reader->md5;
46
47 MD5 checksum for file.
48
49 metadata
50 my $data = $reader->metadata;
51
52 Additional information.
53
54 open
55 $reader = $reader->open($oid);
56
57 Open file. You can also append a callback to perform operation non-
58 blocking.
59
60 $reader->open($oid => sub {
61 my ($reader, $err) = @_;
62 ...
63 });
64 Mojo::IOLoop->start unless Mojo::IOLoop->is_running;
65
66 read
67 my $chunk = $reader->read;
68
69 Read chunk. You can also append a callback to perform operation non-
70 blocking.
71
72 $reader->read(sub {
73 my ($reader, $err, $chunk) = @_;
74 ...
75 });
76 Mojo::IOLoop->start unless Mojo::IOLoop->is_running;
77
78 seek
79 $reader = $reader->seek(13);
80
81 Change current position.
82
83 size
84 my $size = $reader->size;
85
86 Size of entire file in bytes.
87
88 slurp
89 my $data = $reader->slurp;
90
91 Slurp all remaining data from file. You can also append a callback to
92 perform operation non-blocking.
93
94 $reader->slurp(sub {
95 my ($reader, $err, $data) = @_;
96 ...
97 });
98 Mojo::IOLoop->start unless Mojo::IOLoop->is_running;
99
100 tell
101 my $pos = $reader->tell;
102
103 Current position.
104
105 upload_date
106 my $time = $reader->upload_date;
107
108 Date file was uploaded.
109
111 Mango, Mojolicious::Guides, <http://mojolicio.us>.
112
113
114
115perl v5.28.0 2018-03-17 Mango::GridFS::Reader(3)