{"id":18707330,"url":"https://github.com/topac/moped-gridfs","last_synced_at":"2026-04-29T09:37:18.997Z","repository":{"id":56884500,"uuid":"20863163","full_name":"topac/moped-gridfs","owner":"topac","description":"mongoDB GridFS implementation for Moped","archived":false,"fork":false,"pushed_at":"2019-11-02T20:33:51.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-16T21:21:35.817Z","etag":null,"topics":["gridfs","mongodb","moped"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/topac.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-06-15T19:16:34.000Z","updated_at":"2019-11-02T20:34:23.000Z","dependencies_parsed_at":"2022-08-20T23:40:50.282Z","dependency_job_id":null,"html_url":"https://github.com/topac/moped-gridfs","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/topac/moped-gridfs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/topac%2Fmoped-gridfs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/topac%2Fmoped-gridfs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/topac%2Fmoped-gridfs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/topac%2Fmoped-gridfs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/topac","download_url":"https://codeload.github.com/topac/moped-gridfs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/topac%2Fmoped-gridfs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32420350,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T06:29:02.080Z","status":"ssl_error","status_checked_at":"2026-04-29T06:29:00.631Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gridfs","mongodb","moped"],"created_at":"2024-11-07T12:17:30.988Z","updated_at":"2026-04-29T09:37:18.981Z","avatar_url":"https://github.com/topac.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# moped-gridfs\n\nAdd [GridFS support](http://docs.mongodb.org/manual/core/gridfs) to the [Moped driver](https://github.com/mongoid/moped).\n\nMoped is a fast MongoDB driver for Ruby,\nbut it does not implement the GridFS specifications\n(while [mongo-ruby-driver](https://github.com/mongodb/mongo-ruby-driver) does).\n\n## Bucket\n\nGridFS places the collections in a common bucket by prefixing each with the bucket name.\nBy default, GridFS uses two collections with names prefixed by \"fs\" bucket: _fs.files_ and _fs.chunks_.\n\nYou can choose a different bucket name than \"fs\", and create multiple buckets in a single database.  \nAccess the default bucket (named \"fs\") this way:\n\n```ruby\n  require 'moped'\n  require 'moped/gridfs'\n\n  session = Moped::Session.new([\"127.0.0.1:27017\"])\n  session.use(\"test\")\n  bucket = session.bucket #\u003cMoped::GridFS::Bucket:7ffbdbd4e160 name=fs\u003e\n```\nor\n```ruby\n  bucket = Moped::GridFS::Bucket.new(session) #\u003cMoped::GridFS::Bucket:7fc06db72c00 name=fs\u003e\n```\n\nA list of all the buckets can be retrieved with `Session#buckets`.\nFor example, you can access the _photos_ bucket with `session.buckets['photos']`.\n\nTo open a file call `Bucket#open`, with the filename (or the _id) and the open mode.\nA more generic selector can be also given instead of the filename.\n\n## File\n\nThe GridFS::File class exposes an API similar to the ruby File class.\n\n```ruby\n  file = bucket.open(\"myfile\", \"w+\") #\u003cMoped::GridFS::File:7f88599a58b0 bucket=fs _id=539c532ddb13a973ed000001 mode=w+ filename=myfile length=0\u003e\n  file.write(\"foobar\") # 6\n  file.seek(3) # 3\n  file.read # \"bar\"\n```\n\nAll the [open modes](http://www.ruby-doc.org/core-2.1.2/IO.html#method-c-new-label-IO+Open+Mode) are supported:\nr, r+, w, w+, a and a+.\n\nGridFS::File attributes are: _id, length, chunk_size, filename, content_type, md5, aliases, metadata and uploadDate.\nSome of them may be changed if the file is opened in write/append mode.\n\n```ruby\n  file.content_type # \"application/octet-stream\"\n  file.md5 # \"3858f62230ac3c915f300c664312c63f\"\n  file.filename = \"test\"\n  file.filename # \"test\"\n```\n\n## Thread safe?\nIt depends on what you're doing.  \nYou may face race conditions if many threads are writing on the same file a buffer that have to be splitted onto multiple chunks. This is due to how the GridFS specs have been designed: [read this](https://jira.mongodb.org/browse/NODE-157).\n\n## Performance\n\nAre pretty much the same of mongo-ruby-driver (run the script perf/compare.rb).\n\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n    gem 'moped-gridfs'\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install moped-gridfs\n\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftopac%2Fmoped-gridfs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftopac%2Fmoped-gridfs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftopac%2Fmoped-gridfs/lists"}