{"id":13724798,"url":"https://github.com/hnq90/react-native-filesystem-v1","last_synced_at":"2025-05-07T19:30:49.299Z","repository":{"id":57337012,"uuid":"100007040","full_name":"hnq90/react-native-filesystem-v1","owner":"hnq90","description":"Simple file system API for React Native on iOS \u0026 Android \u0026 Windows.","archived":true,"fork":false,"pushed_at":"2017-11-20T03:36:36.000Z","size":171,"stargazers_count":15,"open_issues_count":7,"forks_count":5,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-17T19:34:26.804Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hnq90.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":"2017-08-11T07:52:58.000Z","updated_at":"2024-09-07T01:00:22.000Z","dependencies_parsed_at":"2022-09-12T09:51:16.039Z","dependency_job_id":null,"html_url":"https://github.com/hnq90/react-native-filesystem-v1","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hnq90%2Freact-native-filesystem-v1","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hnq90%2Freact-native-filesystem-v1/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hnq90%2Freact-native-filesystem-v1/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hnq90%2Freact-native-filesystem-v1/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hnq90","download_url":"https://codeload.github.com/hnq90/react-native-filesystem-v1/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252943617,"owners_count":21829276,"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":[],"created_at":"2024-08-03T01:02:03.593Z","updated_at":"2025-05-07T19:30:44.279Z","avatar_url":"https://github.com/hnq90.png","language":"Java","funding_links":[],"categories":["Java"],"sub_categories":[],"readme":"This is a forked repository of [benwixen's react-native-filesystem](https://github.com/benwixen/react-native-filesystem) with purpose to support React Native Windows.\n\n# react-native-filesystem-v1 [![npm version](https://img.shields.io/npm/v/react-native-filesystem-v1.svg?style=flat)](https://www.npmjs.com/package/react-native-filesystem-v1)\nSimple file system access on iOS \u0026amp; Android \u0026amp; Windows.\n\nAll interaction is promise-based, and all content is \nwritten and read as UTF-8.\n\n## Setup\n\n    npm install react-native-filesystem-v1 --save\n    react-native link react-native-filesystem-v1\n    \nThis project is based on the [9-project-layout](https://github.com/benwixen/9-project-layout).\n\n## Usage\n\nFor a full list of available methods, see the [API Reference](docs/reference.md).\n\n### Write to files\n\n```javascript\nimport FileSystem from 'react-native-filesystem-v1';\n\nasync function writeToFile() {\n  const isAppend = true; // If this variable is set to true, content will be appended to the file.\n  const fileContents = 'This is a my content.';\n  await FileSystem.writeToFile('my-directory/my-file.txt', fileContents, isAppend);\n  console.log('file is written');\n}\n```\n\nSub-directories are created automatically.\n\n### Read from files\n\n```javascript\nasync function readFile() {\n  const fileContents = await FileSystem.readFile('my-directory/my-file.txt');\n  console.log(`read from file: ${fileContents}`);\n}\n```\n\n### Delete files or folders\n\n```javascript\nasync function deleteFile() {\n  await FileSystem.delete('my-directory/my-file.txt');\n  console.log('file is deleted');\n}\n```\n\n### Check if files or directories exist\n\n```javascript\nasync function checkIfFileExists() {\n  const fileExists = await FileSystem.fileExists('my-directory/my-file.txt');\n  const directoryExists = await FileSystem.directoryExists('my-directory/my-file.txt');\n  console.log(`file exists: ${fileExists}`);\n  console.log(`directory exists: ${directoryExists}`);\n}\n```\n\n### Selecting a storage class\n\nAll commands also take an optional last argument specifying a storage class. \nThese classes roughly correspond to the four points of the \n[iOS Data Storage Guidelines](https://developer.apple.com/icloud/documentation/data-storage/index.html), \nand have similar behaviour on Android. Example usage:\n\n```javascript\nFileSystem.writeToFile('my-file.txt', 'My content', false, FileSystem.storage.important);\n```\n\nFiles need to be read from the same storage class they're saved to, and two files can have the same \nname if they're located in different storages. The options are:\n\n| Storage class | Description |\n|---------------|-------------|\n| `storage.backedUp` | These files are automatically backed up on supported devices\n| `storage.important` | Excluded from backup, but still kept around in low-storage situations\n| `storage.auxiliary` | Files that the app can function without. Can be deleted by the system in low-storage situations.\n| `storage.temporary` | For temporary files and caches. Can be deleted by the system any time.\n\nFor full details, see the [API Reference](docs/reference.md).\n\n## Questions?\n\n*Why yet another file system library?*   \nI simply couldn't find one that satisfied my basic needs for simplicity.\n\n*Why not use the built-in AsyncStorage?*   \n[AsyncStorage](https://facebook.github.io/react-native/docs/asyncstorage.html) is fine, but some \ntimes you want more control as to where the content is stored. This library lets you put it \nin backed-up folders, or play nice by marking content that can be deleted when the \n phone runs low on space.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhnq90%2Freact-native-filesystem-v1","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhnq90%2Freact-native-filesystem-v1","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhnq90%2Freact-native-filesystem-v1/lists"}