{"id":22347702,"url":"https://github.com/laomu1988/temp-data","last_synced_at":"2025-03-26T10:43:06.635Z","repository":{"id":57157590,"uuid":"81517158","full_name":"laomu1988/temp-data","owner":"laomu1988","description":"简单的临时数据存放，数据操作和普通对象一样简单","archived":false,"fork":false,"pushed_at":"2017-03-09T08:50:15.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-04T16:19:02.517Z","etag":null,"topics":["database"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/laomu1988.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}},"created_at":"2017-02-10T02:23:25.000Z","updated_at":"2017-02-10T05:18:09.000Z","dependencies_parsed_at":"2022-09-07T06:21:38.241Z","dependency_job_id":null,"html_url":"https://github.com/laomu1988/temp-data","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laomu1988%2Ftemp-data","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laomu1988%2Ftemp-data/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laomu1988%2Ftemp-data/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laomu1988%2Ftemp-data/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/laomu1988","download_url":"https://codeload.github.com/laomu1988/temp-data/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245641317,"owners_count":20648637,"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":["database"],"created_at":"2024-12-04T10:10:24.770Z","updated_at":"2025-03-26T10:43:06.616Z","avatar_url":"https://github.com/laomu1988.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 简单的临时数据存放，数据操作和普通对象一样简单\n将数据存储下来，下次启动程序后会自动从本地读取数据\n\n\n## 安装\n```sh\nnpm install temp-data --save\n```\n\n## 使用\n```js\nvar db = require('temp-data');\nvar temp = db(__dirname + '/temp.json',\n    {\n        count: 0\n    },\n    {\n        timeout: 100\n    }\n);\n\nif(!temp.count)  temp.count = 0;\n// 统计程序启动的次数\ntemp.count += 1;\ntemp.$save();\n```\n\n## 函数及参数\n* 初始化\n    - path:        保存数据的路径\n    - defaultData: 默认数据\n    - config      配置对象\n        - timeout: 保存数据延迟时间,避免短时间内重复操作，单位ms，默认10000ms\n* $save(isRightNow) 比较当前数据是否改变，假如改变则存储到本地。 其中使用的lodash的节流函数，无需担心短时间内多次操作\n    - isRightNow:  是否立即存储(不使用节流函数),默认false\n\n\n## 注意事项：\n* temp.__hash 将会用来存放对象的hash值，请不要使用这个变量\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaomu1988%2Ftemp-data","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flaomu1988%2Ftemp-data","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaomu1988%2Ftemp-data/lists"}