{"id":16265023,"url":"https://github.com/waseemsabir/firestore_size","last_synced_at":"2025-03-19T23:30:32.170Z","repository":{"id":64732179,"uuid":"577688437","full_name":"WaseemSabir/firestore_size","owner":"WaseemSabir","description":"Python library to calculate the approximate size of a firestore document","archived":false,"fork":false,"pushed_at":"2022-12-13T17:17:03.000Z","size":15,"stargazers_count":2,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-17T11:55:03.159Z","etag":null,"topics":["firestore","firestore-document","python","python3","size-calculation","sizeof"],"latest_commit_sha":null,"homepage":"","language":"Python","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/WaseemSabir.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-12-13T09:54:59.000Z","updated_at":"2023-09-13T13:49:58.000Z","dependencies_parsed_at":"2022-12-15T02:30:42.102Z","dependency_job_id":null,"html_url":"https://github.com/WaseemSabir/firestore_size","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WaseemSabir%2Ffirestore_size","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WaseemSabir%2Ffirestore_size/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WaseemSabir%2Ffirestore_size/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WaseemSabir%2Ffirestore_size/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WaseemSabir","download_url":"https://codeload.github.com/WaseemSabir/firestore_size/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244524441,"owners_count":20466425,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["firestore","firestore-document","python","python3","size-calculation","sizeof"],"created_at":"2024-10-10T17:05:32.805Z","updated_at":"2025-03-19T23:30:31.896Z","avatar_url":"https://github.com/WaseemSabir.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# firestore_size\n[![Tests](https://github.com/WaseemSabir/firestore_size/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/WaseemSabir/firestore_size/actions/workflows/test.yml)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nPython library to calculate the approximate size of a firestore document. This can be used for firebase storage cost analysis, among other things.\n\n## Installation\n```bash\npip install firestore_size\n```\n\n## Usage\n```bash\nfrom firestore_size.calculate import document_size\n\n# initialize firebase and firestore client\n\ncollection = db.collection(\"data\")\ndoc = collection.doc(id).get()\ndata = doc.to_dict()\n\ndoc_size = document_size(data)\nprint(\"Doc Size is \", doc_size)\n```\n\n## How it calculates?\n\nCheckout how the size of firestore docs is calculated in [documentation](https://firebase.google.com/docs/firestore/storage-size#document-name-size). \n\nBrief description is\n- Array -\tThe sum of the sizes of its values\n- Boolean -\t1 byte\n- Bytes -\tByte length\n- Date and time -\t8 bytes\n- Floating-point number -\t8 bytes\n- Geographical point - 16 bytes\n- Integer -\t8 bytes\n- Map\t- The size of the map, calculated the same way as document size\n- Null -\t1 byte\n- Reference\t- The document name size\n- Text string -\tNumber of UTF-8 encoded bytes + 1\n\n\n## What is not included?\n\nDoes not take into account the name of a document, check [docs on how it's calculated.](https://firebase.google.com/docs/firestore/storage-size#document-name-size)\n\nDoes not take into account indexing. Indexes can be disabled - [docs](https://firebase.google.com/docs/firestore/query-data/index-overview?authuser=0#single-field_index_exemptions) - to free up more space. \n\n## How to contribute?\n\nCreate issues for any bugs caught. Fork the repo to your account and send pull request with your changes.\n\nRun tests using\n```bash\npython3 setup.py pytest\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwaseemsabir%2Ffirestore_size","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwaseemsabir%2Ffirestore_size","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwaseemsabir%2Ffirestore_size/lists"}