{"id":13475622,"url":"https://github.com/joe-re/async-storage-repl","last_synced_at":"2025-05-01T23:30:24.888Z","repository":{"id":57185806,"uuid":"90558962","full_name":"joe-re/async-storage-repl","owner":"joe-re","description":"AsyncStorageRepl provides you to access remote ReactNative application's AsyncStorage from your node REPL.","archived":false,"fork":false,"pushed_at":"2017-12-14T09:56:42.000Z","size":39,"stargazers_count":36,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-01T09:16:50.327Z","etag":null,"topics":["async-storage","node","react-native","repl"],"latest_commit_sha":null,"homepage":"","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/joe-re.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-05-07T20:12:50.000Z","updated_at":"2020-12-29T00:43:51.000Z","dependencies_parsed_at":"2022-09-14T06:10:22.265Z","dependency_job_id":null,"html_url":"https://github.com/joe-re/async-storage-repl","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joe-re%2Fasync-storage-repl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joe-re%2Fasync-storage-repl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joe-re%2Fasync-storage-repl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joe-re%2Fasync-storage-repl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joe-re","download_url":"https://codeload.github.com/joe-re/async-storage-repl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224280925,"owners_count":17285554,"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":["async-storage","node","react-native","repl"],"created_at":"2024-07-31T16:01:21.969Z","updated_at":"2024-11-12T13:26:35.044Z","avatar_url":"https://github.com/joe-re.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# AsyncStorageREPL\n\nAsyncStorageRepl provides you to access remote ReactNative application's AsyncStorage from your node REPL.\n\n![gif](https://cloud.githubusercontent.com/assets/4954534/26222189/09924ee2-3c54-11e7-8247-ed15afa7cd31.gif)\n\n```\nnpm i async-storage-repl -D\n```\n\n# BasicUsage\n\n1. Write bellow code in your ReactNative Application.\n\n```js\nimport AsyncStorageREPL from 'async-storage-repl';\nAsyncStorageREPL().connect();\n```\n\n2. Start node REPL.\n\n```sh\n./node_modules/.bin/async-storage-repl\n```\n\n3. Let's get access your ReactNative application's storage from your node REPL.\n\n```sh\n$ ./node_modules/.bin/async-storage-repl\n\u003e RNAsyncStorage.getItem('item1')\nnull\n\u003e RNAsyncStorage.setItem('item1', 'nice value!')\nnull\n\u003e RNAsyncStorage.getItem('item1')\n'nice value!'\n\u003e RNAsyncStorage.getAllKeys()\n[ 'reduxPersist:timeline',\n  'item1',\n  'reduxPersist:auth',\n  'reduxPersist:nav' ]\n```\n\n# Example\n\n[example](/example)\n\n# API\n\n## AsyncStorage APIs\nAsyncStorageREPL provides RNAsyncStorage on your node REPL as a global object.\nYou can access [AsyncStorage's all APIs](https://facebook.github.io/react-native/docs/asyncstorage.html) via this object.\n\n- getAllKeys(): string[]\n- getItem(key: string)\n- setItem(key: string, value: string)\n- removeItem(key: string)\n- mergeItem(key: string, value: string)\n- clear()\n- flushGetRequests()\n- multiGet(keys: string[])\n- multiSet(keyValuePairs: string[][])\n- multiRemove(keys: string[])\n- multiMerge(keyValuePairs: string[][])\n\nAsyncStorageREPL's methods args are guaranteed type-safe by [flow-runtime](https://codemix.github.io/flow-runtime/).\n\n```sh\n\u003e RNAsyncStorage.getItem(1)\nRuntimeTypeError: key must be a string\n\nExpected: string\n\nActual: number\n\n```\n\n## dump \u0026 load\n\nYou can save \u0026 load RN Application AsyncStorage data.\n\n`dump()` provides you getting dump.\n`load(string[][])` provides you loading dump.\n\n```sh\n\u003e const data = RNAsyncStorage.dump()\nundefined\n\u003e data\n[ [ 'comments', '[\"foo\",\"bar\",\"baz\"]' ] ]\n\u003e fs.writeSync('./dump1.txt', JSON.stringify(data))\n```\n\n```sh\n\u003e const data = JSON.parse(fs.readSync('./dump1.txt'))\n\u003e RNAsyncStorage.load(data)\nnull\n```\n# Advanced Usage\n\n## ReactNative side\n\nAsyncStorageREPL() accepts an object with a host and port key.\nPort key must be matched REPL side.\nYou don't need specify a host in case of running on a simulator.\nbut in case of runnning on a real device, specify your computer host.\n\n```js\nAsyncStorageREPL({ host: 'localhost', port: 8080 }) // default\n  .connect();\n```\n\n## REPL side\n\nYou can specify portNo --port option.\n\n```sh\nasync-storage-repl --port 8080\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoe-re%2Fasync-storage-repl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoe-re%2Fasync-storage-repl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoe-re%2Fasync-storage-repl/lists"}