{"id":17170654,"url":"https://github.com/cawa-93/fs-nano-store","last_synced_at":"2025-10-14T10:42:39.667Z","repository":{"id":65084470,"uuid":"581786400","full_name":"cawa-93/fs-nano-store","owner":"cawa-93","description":"A minimalistic, secure, type-safe, zero-dependencies, persistent data store","archived":false,"fork":false,"pushed_at":"2025-09-29T22:50:27.000Z","size":366,"stargazers_count":4,"open_issues_count":10,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-30T00:28:14.155Z","etag":null,"topics":["filesystem","node","npm","persistent-storage","zero-dependencies"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/fs-nano-store","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/cawa-93.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"custom":"https://www.buymeacoffee.com/kozack/"}},"created_at":"2022-12-24T10:28:11.000Z","updated_at":"2025-02-20T23:55:09.000Z","dependencies_parsed_at":"2023-12-18T01:28:43.834Z","dependency_job_id":"10a1aad7-f0d4-4d7a-8c30-2f490e4b543e","html_url":"https://github.com/cawa-93/fs-nano-store","commit_stats":{"total_commits":203,"total_committers":2,"mean_commits":101.5,"dds":0.4482758620689655,"last_synced_commit":"6669ac3c418b8063ce1309d37fc6223dee1d52e6"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/cawa-93/fs-nano-store","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cawa-93%2Ffs-nano-store","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cawa-93%2Ffs-nano-store/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cawa-93%2Ffs-nano-store/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cawa-93%2Ffs-nano-store/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cawa-93","download_url":"https://codeload.github.com/cawa-93/fs-nano-store/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cawa-93%2Ffs-nano-store/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279018784,"owners_count":26086452,"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-14T02:00:06.444Z","response_time":60,"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":["filesystem","node","npm","persistent-storage","zero-dependencies"],"created_at":"2024-10-14T23:31:21.658Z","updated_at":"2025-10-14T10:42:39.633Z","avatar_url":"https://github.com/cawa-93.png","language":"TypeScript","funding_links":["https://www.buymeacoffee.com/kozack/","https://www.buymeacoffee.com/kozack"],"categories":[],"sub_categories":[],"readme":"[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner-direct-single.svg)](https://stand-with-ukraine.pp.ua)\n\n---\n\n# Nano filesystem storage\n\n\u003ca href=\"https://www.buymeacoffee.com/kozack\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/v2/default-red.png\" height=\"60\" alt=\"Buy Me A Coffee\"\u003e\u003c/a\u003e\n\nA minimalistic, secure, type-safe, zero-dependencies, persistent data store.\n\n\u003e **Note**\n\u003e If you want safely use it in electron app look at **[electron-nano-store](https://github.com/cawa-93/electron-nano-store)**\n\n## Usage\n\n```ts\nimport { defineStore } from \"fs-nano-store\";\n\n/**\n * Declare types for you storage\n */\ntype Store = {\n\tname: string,\n\trole: 'admin' | 'user'\n}\n\nconst { get, set, changes } = await defineStore\u003cStore\u003e('/path/to/storage-file.json')\n\nget('name') // undefined\nset('name', 'Alex')\nget('name') // Alex\n\n// Store is Type-safe\n// TS Error: Argument of type '\"wrong-role\"' is not assignable to parameter of type '\"admin\" | \"user\"'.\nset('role', 'wrong-role')\n\n// fs-nano-store automatically tracks any storage-file.json changes.\n// Additionally, you can addListener on the `changed` event that emits\n// if the store file has been modified somehow outside defined store methods.\nchanges.addListener('changed', () =\u003e {\n})\n```\n\n\u003e **Note**\n\u003e \n\u003e Objects in store are immutable and will be deeply cloned on each `get`/`set`. \n\u003e ```ts\n\u003e const obj = {}\n\u003e store.set('obj', obj)\n\u003e store.get('obj') === obj // false\n\u003e store.get('obj') === store.get('obj') // false\n\u003e store.get('obj').bar = 'baz' // will no have effect\n\u003e obj.bar = 'baz' // will not affected to stored data\n\n\n### Custom serializer\n\nBy default, all data is serialized in JSON using global `JSON`.\nSo if you want to store more complex data types like `Date` or `Map`, or want to have custom `stringify`/`parse` logic,\nyou need to use your own serializer that supports those data types. Example with [superjson](https://github.com/blitz-js/superjson):\n\n```ts\nimport { defineStore } from 'fs-nano-store'\nimport superjson from 'superjson';\n\ntype Store = {\n\tdate: Date,\n}\n\nconst store = defineStore\u003cStore\u003e('store-file.json', {\n\tserializer: superjson\n})\n\nstore.set('date', new Date)\nstore.get('date') // Date object\n```\n\n## Migrating from v0.2.x to v0.3.x\nIn https://github.com/cawa-93/fs-nano-store/commit/bd2dfb50c92eadae68f6a12e406acf6daacd05f7 Was changed how exactly data saving to filesystem. Old store files are incompatible.\nYou may need manually convert old data to new format by command:\n```js\nconst newDataStr = JSON.stringify(\n  Object.entries(serializer.parse(oldDataStr))\n  .map(([k,v]) =\u003e [k,serializer.stringify(v)])  \n) \n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcawa-93%2Ffs-nano-store","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcawa-93%2Ffs-nano-store","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcawa-93%2Ffs-nano-store/lists"}