{"id":30028674,"url":"https://github.com/bchr02/filejson","last_synced_at":"2025-08-06T15:54:23.792Z","repository":{"id":57235754,"uuid":"68780225","full_name":"bchr02/filejson","owner":"bchr02","description":"Seamlessly syncs a JavaScript value to a JSON file in the background whenever that value changes.","archived":false,"fork":false,"pushed_at":"2019-04-18T03:30:41.000Z","size":19,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-29T05:17:56.900Z","etag":null,"topics":["autosave","database","document","document-store","file","javascript","json","nosql","orm","proxies"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/bchr02.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":"2016-09-21T04:30:36.000Z","updated_at":"2022-08-07T17:40:32.000Z","dependencies_parsed_at":"2022-08-23T16:20:12.191Z","dependency_job_id":null,"html_url":"https://github.com/bchr02/filejson","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/bchr02/filejson","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bchr02%2Ffilejson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bchr02%2Ffilejson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bchr02%2Ffilejson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bchr02%2Ffilejson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bchr02","download_url":"https://codeload.github.com/bchr02/filejson/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bchr02%2Ffilejson/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269108441,"owners_count":24361214,"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-08-06T02:00:09.910Z","response_time":99,"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":["autosave","database","document","document-store","file","javascript","json","nosql","orm","proxies"],"created_at":"2025-08-06T15:54:22.572Z","updated_at":"2025-08-06T15:54:23.781Z","avatar_url":"https://github.com/bchr02.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [filejson](https://github.com/bchr02/filejson)\n\n[![NPM](https://nodei.co/npm/filejson.png?downloads=true\u0026stars=true)](https://nodei.co/npm/filejson/)\n\nSeamlessly sync a JavaScript value to a JSON encoded file automatically in the background whenever that value changes. A value can be a Javascript: string, number, boolean, null, object, or an array. The value can be structured in an array or an object to allow for more complex data stores. These structures can also be nested. As a result, you can use this module as a simple document store for storing semi structured data.\n\n## Requirements\n[ECMAScript 6 Reflect and Proxy objects](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy)  support, which is found natively in Node.js \u003e= 6. If you are using a version of Node.js \u003c 6, use a polyfill, such as [harmony-reflect](https://github.com/tvcutsem/harmony-reflect). Proxy support is key for this module working so eloquently. Other non-Proxy based modules require function calls each time you wish to save an object. Unlike those, [filejson](https://github.com/bchr02/filejson) is as easy as ```file.contents = \"my new value\"``` or ```file.contents = {\"msg\": \"Hello World\"}``` and the changes are automatically saved to disk.\n\n## Installation\n\n```javascript\nnpm install filejson --save\n```\n[If you are using Node.js 5 or earlier, some additional installation and usage steps are needed. Click here.](#additional-installation-and-usage-steps-for-those-using-nodejs-5-or-earlier)\n\n## Example usage\n```javascript\nvar Filejson = require(\"filejson\");\nvar file1 = new Filejson();\n\nfile1.load(\"file1.json\", proceed); // file1.json contains {\"abc\": \"123\"}\n\nfunction proceed(error, file) {\n    if(error) {\n        console.error(error);\n        return;\n    }\n\n    console.log(file.contents); // outputs {\"abc\": \"123\"}\n\n    file.contents.msg = \"Hello World\"; // saves {\"abc\": \"123\", \"msg\": \"Hello World\"} to file1.json.\n\n    console.log(file.contents); // outputs {\"abc\": \"123\", \"msg\": \"Hello World\"}\n\n}\n```\n\n## Additional installation and usage steps for those using Node.js 5 or earlier\n\n* You will need a polyfill such as [harmony-reflect](https://github.com/tvcutsem/harmony-reflect):\n```\nnpm install harmony-reflect --save\n```\n* In addition to requiring filejson, you will need to require harmony-reflect at the top of your app, like this:\n```javascript\nvar Reflect = require('harmony-reflect');\n```\n* Lastly, every time you run your app you will need to use the node --harmony_proxies flag, like this:\n```\nnode --harmony_proxies index.js\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbchr02%2Ffilejson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbchr02%2Ffilejson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbchr02%2Ffilejson/lists"}