{"id":23480378,"url":"https://github.com/joshmerlino/filestore-json","last_synced_at":"2025-04-14T22:55:05.931Z","repository":{"id":37817441,"uuid":"371786032","full_name":"JoshMerlino/filestore-json","owner":"JoshMerlino","description":"Easily sync JSON objects of any shape with the filesystem.","archived":false,"fork":false,"pushed_at":"2025-01-16T11:38:15.000Z","size":1904,"stargazers_count":2,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-14T22:54:58.364Z","etag":null,"topics":["filestore","filesystem","json","json-config","npm","persistant"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/filestore-json","language":"TypeScript","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/JoshMerlino.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-28T18:22:03.000Z","updated_at":"2024-10-23T12:23:00.000Z","dependencies_parsed_at":"2023-02-19T07:01:04.335Z","dependency_job_id":"cbd2f2bb-6591-4161-9dd8-68647b126792","html_url":"https://github.com/JoshMerlino/filestore-json","commit_stats":{"total_commits":507,"total_committers":4,"mean_commits":126.75,"dds":0.2859960552268245,"last_synced_commit":"7bdbb7cca65f3068b3fecc06112631bdf1a7dbc8"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":"JoshMerlino/ts-package","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoshMerlino%2Ffilestore-json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoshMerlino%2Ffilestore-json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoshMerlino%2Ffilestore-json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoshMerlino%2Ffilestore-json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JoshMerlino","download_url":"https://codeload.github.com/JoshMerlino/filestore-json/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248975330,"owners_count":21192208,"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":["filestore","filesystem","json","json-config","npm","persistant"],"created_at":"2024-12-24T20:11:25.939Z","updated_at":"2025-04-14T22:55:05.913Z","avatar_url":"https://github.com/JoshMerlino.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# filestore-json\n### Checks\n* [![Build](https://github.com/JoshMerlino/filestore-json/actions/workflows/build.yml/badge.svg)](https://github.com/JoshMerlino/filestore-json/actions/workflows/build.yml)\n* [![Code Style Analysis](https://github.com/JoshMerlino/filestore-json/actions/workflows/code-style-analysis.yml/badge.svg)](https://github.com/JoshMerlino/filestore-json/actions/workflows/code-style-analysis.yml)\n* [![Test CI](https://github.com/JoshMerlino/filestore-json/actions/workflows/test-ci.yml/badge.svg)](https://github.com/JoshMerlino/filestore-json/actions/workflows/test-ci.yml)\n\n![](https://img.shields.io/npm/dt/filestore-json)\n![](https://img.shields.io/github/issues/JoshMerlino/filestore-json)\n![](https://img.shields.io/github/issues-pr/JoshMerlino/filestore-json)\n\nEasily sync JSON objects of any shape with the filesystem.\n\n# Features\n* Read \u0026 write to JSON files on a storage device without the need to interact with the filesystem.\n* Persistant data between process restarts.\n* Ability to determine age (ms since last write).\n* Cache JSON responses from network requests.\n* Automaticly updates internal value when JSON file is modified.\n* Strong type internal value with type annotations.\n\n# Examples\n\n## Creating a store\n```ts\nimport JSONStore from \"filestore-json\";\nimport path from \"path\";\n\n// Initialize the store.\nconst store = JSONStore.from(path.resolve(\"path/to/your/store.json\"));\n\n// With types\ntype Type = Record\u003cstring, any\u003e;\nconst store = JSONStore.from\u003cType\u003e(path.resolve(\"path/to/your/store.json\"));\n```\n\n## Reading \u0026 writing to the store\n```ts\n// Read value of store.\nconsole.log(store.value); // -\u003e {}\n\n// Update store value.\nstore.value = { myObject: false };\n\n// Read new value of store.\nconsole.log(store.value); // -\u003e { myObject: false }\n```\n\n## Creating a store with default values\n```ts\n// Create object with store defaults\nconst defaults = { defaultValue: true };\n\n// Initialize store.\nconst store = JSONStore.from(path.resolve(\"path/to/your/store.json\"), defaults);\n\n// Read value of store.\nconsole.log(store.value); // -\u003e { defaultValue: true }\n\n// Update store value.\nstore.value = { myObject: false };\n\n// Read new value of store.\nconsole.log(store.value); // -\u003e { myObject: false, defaultValue: true }\n```\n\n## Resetting a stores value back to the default\n```ts\n// Update store value.\nstore.value = { myObject: false };\n\n// Read new value of store.\nconsole.log(store.value); // -\u003e { myObject: false }\n\n// Clear value\nstore.clear();\n\n// Read value of store.\nconsole.log(store.value); // -\u003e {}\n```\n\n## Getting the age of the store (ms since last write)\n```ts\n// Read age of store.\nconsole.log(store.age); // -\u003e 0\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshmerlino%2Ffilestore-json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoshmerlino%2Ffilestore-json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshmerlino%2Ffilestore-json/lists"}