The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

MongoDBx::Tiny::GridFS - wrapper class of MongoDB::GridFS

SUBROUTINES/METHODS

new

  $gridfs = MongoDBx::Tiny::GridFS->new(
        $database->get_gridfs,$fields_name
  );

gridfs, fields

  # get Mongodb::GridFS
  $gridfs_raw = $gridfs->gridfs;

  # get fields name
  $gridfs_field_name = $gridfs->field;

put

  $gridfs->put('/tmp/foo.txt', {"filename" => 'foo.txt' });
  $gridfs->put('/tmp/bar.txt','bar.txt');
  
  $fh = IO::File->new('/tmp/baz.txt','r');
  $gridfs->put($fh,'baz.txt');

get

  # MongoDBx::Tiny::GridFS::File
  $gridfs_file = $gridfs->get({ filename => 'foo.txt' });
  $foo_txt = $gridfs_file->slurp;

  $bar_txt = $gridfs->get('bar.txt')->slurp;

remove

  $gridfs->remove({ filename => 'foo.txt' });
  $gridfs->remove('bar.txt');

exists_file

  $gridfs->exists_file({ filename => 'foo.txt' });
  $gridfs->exists_file('bar.txt');

MongoDBx::Tiny::GridFS::File

  wrapper class of MongoDB::GridFS::File

new

    $gf = MongoDBx::Tiny::GridFS::File->new( $gridfs->find_one($query), $self->field );

gridfs_file, gf

    # MongoDB::GridFS::File
    $gf_raw = $gf->gridfs_file;

print

  # MongoDB::GridFS::File::print
  $gf->print($fh,$length,$offset);

slurp

  # MongoDB::GridFS::File::slurp
  $all = $gf->slurp();
  $buf = $gf->slurp($length,$offset);

field

  field name. default is  "filename"

_id,chunk_size,upload_date,md5

  MongoDB::GridFS::File attributes

AUTHOR

Naoto ISHIKAWA, <toona at seesaa.co.jp>

LICENSE AND COPYRIGHT

Copyright 2013 Naoto ISHIKAWA.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.