{"id":20134980,"url":"https://github.com/tomkennedy22/jsfsql","last_synced_at":"2026-05-06T06:34:48.694Z","repository":{"id":206711314,"uuid":"716371833","full_name":"tomkennedy22/JsFsQL","owner":"tomkennedy22","description":"High-performance Typescript-based file system storage utilization heavy indexing \u0026 partitioning","archived":false,"fork":false,"pushed_at":"2024-06-08T17:14:30.000Z","size":2504,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-14T15:38:50.683Z","etag":null,"topics":["database","javascript","json","orm","partitioning","query","storage","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tomkennedy22.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-09T01:57:34.000Z","updated_at":"2024-06-08T17:14:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"a6683fc5-7448-4ecb-bbfb-5d4cfbe80dfa","html_url":"https://github.com/tomkennedy22/JsFsQL","commit_stats":null,"previous_names":["tomkennedy22/manydexjs"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tomkennedy22/JsFsQL","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomkennedy22%2FJsFsQL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomkennedy22%2FJsFsQL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomkennedy22%2FJsFsQL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomkennedy22%2FJsFsQL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomkennedy22","download_url":"https://codeload.github.com/tomkennedy22/JsFsQL/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomkennedy22%2FJsFsQL/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279161530,"owners_count":26116973,"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","status":"online","status_checked_at":"2025-10-16T02:00:06.019Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["database","javascript","json","orm","partitioning","query","storage","typescript"],"created_at":"2024-11-13T21:12:58.876Z","updated_at":"2025-10-16T06:05:39.196Z","avatar_url":"https://github.com/tomkennedy22.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JsFSQL\n\nThis is a light-weight package that allows for in-memory querying of semi-stuctured data, as well as write \u0026 reading the data to file. \nThe package's big advantage is the heavily partitioned data structure, which provides the following benefits:\n1. When querying based on primary keys, results return in O(1)\n2. When querying based on partition keys, results return in ~O(n/p), n being total data size, p being number of partitions\n3. When querying based on other keys, including partition keys in your query will greatly improve performance\n\n\n\n--------------\n**Create a database** (new or existing)\n```\nlet db = new database({ dbname: \"test_db\", folder_path });\n```\n\n**Read from file. **If you already have data in file with the same db_name and folder_path specified above, you can read the DB file file -\u003e memory\n```\nawait db.read_from_file();\n```\n\n**Add a new table.** Choose indices based on frequently-used query patterns, as including them in queries will greatly improve performance\n```\ndb.add_table({ table_name: \"person_test\", indices: [\"birth_year\", \"birth_state\"], primary_key: \"person_id\" });\n```\n\n\n**Insert data.** Data can either be single element or array of elements. Elements must have field with PK defined\n```\ndb.tables.person_test.insert(data);\n```\n\n\n**Query data**. \n```\nlet results_1994_CA = db.tables.person.find({birth_year: 1994, birth_state: \"CA\"});\nlet results_1994 = db.tables.person.find({birth_year: 1994});\nlet results_pid_1 = db.tables.person.findOne({person_id: 1});\nlet results_pid_1_eq = db.tables.person.findOne({ person_id: { $eq: 1 } });\nlet results_matts = db.tables.person.find({name: \"Matt\"});\nlet results_1990_1994 = db.tables.person.find({$or: [{birth_year: 1990}, {birth_year: 1994}]});\nlet results_gt_1992 = db.tables.person.find({birth_year: {$gt: 1992}});\n```\n\n**Save database \u0026 write to file**\n```\nawait db.save_database();\n```\n\n\n**Query operators**, largely using industry-standard\n| Operator | Notes                                      |\n|----------|--------------------------------------------|\n| $eq      | Value equals                               |\n| $ne      | Value not equal                            |\n| $gt      | Value greater than                         |\n| $gte     | Value greater than or equal to             |\n| $lt      | Value less than                            |\n| $lte     | Value less than or equal to                |\n| $in      | Value in an array                          |\n| $nin     | Value not in an array                      |\n| $or      | Logical OR of multiple queries             |\n\n\n\n---------------\n### Development \u0026 use\nWhen in the folder, run the below command to install all packages needed (really only fs \u0026 path)\n```\nnpm install\n```\n\n\nTo run the test script, simply run the below command\n```\nnpx ts-node src/test.ts\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomkennedy22%2Fjsfsql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomkennedy22%2Fjsfsql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomkennedy22%2Fjsfsql/lists"}