{"id":34741844,"url":"https://github.com/hj5230/data-depot","last_synced_at":"2026-05-08T05:48:09.694Z","repository":{"id":231166706,"uuid":"777219414","full_name":"hj5230/data-depot","owner":"hj5230","description":"A file-based database system designed for storage, retrieval, and management of data. It offers multiple ways to read and store data, along with encryption functionality. DataDepot is an ideal solution for small to medium-sized projects that require a lightweight yet powerful data storage option without the overhead of traditional databases.","archived":false,"fork":false,"pushed_at":"2025-11-11T16:31:47.000Z","size":266,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-26T16:38:06.814Z","etag":null,"topics":["database","npm","storage"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hj5230.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-03-25T12:45:15.000Z","updated_at":"2025-11-11T16:33:14.000Z","dependencies_parsed_at":"2024-04-02T20:25:57.959Z","dependency_job_id":"93990ce8-3830-41b7-a1a2-f15fa7bd1429","html_url":"https://github.com/hj5230/data-depot","commit_stats":null,"previous_names":["hj5230/datadepot"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/hj5230/data-depot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hj5230%2Fdata-depot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hj5230%2Fdata-depot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hj5230%2Fdata-depot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hj5230%2Fdata-depot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hj5230","download_url":"https://codeload.github.com/hj5230/data-depot/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hj5230%2Fdata-depot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32448399,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"ssl_error","status_checked_at":"2026-04-29T22:10:49.234Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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","npm","storage"],"created_at":"2025-12-25T04:16:52.061Z","updated_at":"2026-04-29T23:32:42.297Z","avatar_url":"https://github.com/hj5230.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DataDepot\n\nA file-based database system designed for storage, retrieval, and management of data. It offers multiple ways to read and store data, along with encryption functionality. DataDepot is an ideal solution for small to medium-sized projects that require a lightweight yet powerful data storage option without the overhead of traditional databases.\n\n# Usage\n\n### Installation\n\n**npm**\n\n```bash\nnpm install datadepot\n```\n\n**yarn**\n\n```bash\nyarn add datadepot\n```\n\n**pnpm**\n\n```bash\npnpm add datadepot\n```\n\n### Importing\n\n**cjs**\n\n```javascript\nconst { DataDepot, Depot } = require(\"datadepot\");\n```\n\n**esm**\n\n```javascript\nimport { DataDepot, Depot } from \"datadepot\";\n```\n\n### Creating a db / storage container\n\n```javascript\nconst store = new Depot();\n```\n\n**With TypeScript, you may declare storage type**\n\n```typescript\nconst store = new Depot\u003cRecord\u003cstring, unknown\u003e\u003e();\n```\n\n### CURD Operations\n\n```javascript\nstore.setItem(\"data\", { foo: \"foo\", bar: \"bar\" });\nstore.updateItem(\"data\", { foo: \"bar\" });\nstore.getItem(\"data\"); // { foo: 'bar' }\nstore.removeItem(\"data\");\n```\n\nOne may not duplicate setting keys, update, get or remove a non-existent key, otherwise an exception will be thrown to force the program terminates.\n\n### Exporting and loading\n\n```javascript\nstore.load({ data: { foo: \"foo\", bar: \"bar\" } });\nconst json = store.export(); // { data: { foo: 'foo', bar: 'bar' } }\n```\n\nThe method `load()` will load data and overwrite all data in the db/storage container.\n\nThe method `export()` will export all the keys and their data in json form.\n\nThese two operations shall not be often used unless necessary.\n\n### Clear \u0026 destroy\n\n```javascript\nstore.clear();\n```\n\nAfter calling the member method clear(), the db/storage container will be cleared.\n\n```javascript\nstore.destory();\n```\n\nAfter calling the member method destory(), the db/storage container will be destroyed, accessing the db/storage container afterwards in any way will lead to an exception.\n\n### Writting and Reading\n\n**Write into a chunk file with default options**\n\n```javascript\nDataDepot.write(store, \".\");\n```\n\nAll the data in the db/storage container will be serialized, compressed and save into a single chunk file with the specified directory. The chunk name would be an unix timestamp.\n\n**Specifying options**\n\n```javascript\nDataDepot.write(store, \".\", {\n    chunkName: \"sampleChunk\",\n    key: \"sampleKey\",\n});\n```\n\nThe above example will save the data in a file named sampleChunk. And the file is symmetrically encrypted by the AES algorithm, and the key will be needed when reading the file.\n\n**Dump into multiple files**\n\n```javascript\nDataDepot.write(store, \".\", {\n    chunkName: \"sampleChunk\",\n    key: \"sampleKey\",\n    maxChunkCount: 3\n});\n```\n\nWith `maxChunkCount` option, the data will be evenly save into `n` chunk files.\n\n```javascript\nDataDepot.write(store, \".\", {\n    chunkName: \"sampleChunk\",\n    key: \"sampleKey\",\n    maxChunkSize: 1000,\n});\n```\n\nWith `maxChunkSize` option, the max size of a chunk file can be specified, when the max size is reached, it will move on to next chunk file.\n\nHowever, you may only specify one of the `maxChunkCount` or `maxChunkSize` option, or  an exception will be thrown.\n\n**Read from chunk file(s)**\n\n```javascript\nDataDepot.load(store, \".\", \"sampleChunk\", \"sampleKey\");\n```\n\nOne don't need to worries about multiple file, it will find all chunk files belong to the same chunk name. Key can be omitted if it is not specified when writing.\n\n**write and read from json file**\n\n```javascript\nDataDepot.writeToJson(store, \"sample.json\");\nDataDepot.loadFromJson(store, \"sample.json\");\n```\n\n### About object\n\n```javascript\nclass SampleClass {\n    constructor(a, b) {\n        this.a = a;\n        this.b = b;\n    }\n}\n\nDataDepot.insertAnObject(store, \"object\", new SampleClass(\"a\", \"b\"));\nstore.getItem(\"object\"); // { a: 'a', b: 'b' }\n\nDataDepot.loadFromObject(store, new SampleClass(\"a\", \"b\"));\nstore.getItem(\"a\"); // a\n```\n\nOne may directly insert an object into the db/storage container, or use an object as data (overwritting all the data in db/storage container).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhj5230%2Fdata-depot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhj5230%2Fdata-depot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhj5230%2Fdata-depot/lists"}