{"id":15384653,"url":"https://github.com/amphiluke/cordova-plugin-save-dialog","last_synced_at":"2025-04-15T17:33:01.720Z","repository":{"id":53324673,"uuid":"410217504","full_name":"Amphiluke/cordova-plugin-save-dialog","owner":"Amphiluke","description":"Cordova plugin for opening the native Save dialog and storing a file in the user-selected location","archived":false,"fork":false,"pushed_at":"2023-12-22T14:39:17.000Z","size":25,"stargazers_count":10,"open_issues_count":0,"forks_count":9,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-04-26T05:21:26.379Z","etag":null,"topics":["cordova","cordova-android","cordova-ios","cordova-plugin","dialog","file","save"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/Amphiluke.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}},"created_at":"2021-09-25T08:25:05.000Z","updated_at":"2024-03-04T16:18:00.000Z","dependencies_parsed_at":"2023-12-22T15:59:54.104Z","dependency_job_id":"6cf17f23-4644-4aec-993d-5fa8e2b5aae2","html_url":"https://github.com/Amphiluke/cordova-plugin-save-dialog","commit_stats":{"total_commits":14,"total_committers":2,"mean_commits":7.0,"dds":0.1428571428571429,"last_synced_commit":"58b6db86249ad9368a92f202cfe7842c56330191"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amphiluke%2Fcordova-plugin-save-dialog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amphiluke%2Fcordova-plugin-save-dialog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amphiluke%2Fcordova-plugin-save-dialog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amphiluke%2Fcordova-plugin-save-dialog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Amphiluke","download_url":"https://codeload.github.com/Amphiluke/cordova-plugin-save-dialog/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219888244,"owners_count":16564130,"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":["cordova","cordova-android","cordova-ios","cordova-plugin","dialog","file","save"],"created_at":"2024-10-01T14:43:00.830Z","updated_at":"2024-10-16T21:01:29.798Z","avatar_url":"https://github.com/Amphiluke.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cordova-plugin-save-dialog\n\nThis Cordova plugin displays the native Save dialog which allows users to store a file in the selected location.\n\nIn Android, the plugin utilizes the Storage Access Framework to save a file in a user-selected location as described in the [Android developer guide](https://developer.android.com/training/data-storage/shared/documents-files#create-file).\n\nIn iOS, the `UIDocumentPickerViewController`’s method [`initForExportingURLs:asCopy:`](https://developer.apple.com/documentation/uikit/uidocumentpickerviewcontroller/3566731-initforexportingurls?language=objc) is used for opening a document picker that can export a file to the selected folder. Note that this method is only available in iOS 14.0+, so older iOS versions are not supported by the plugin.\n\n## Installation\n\n```\ncordova plugin add cordova-plugin-save-dialog --save\n```\n\n## API\n\nThe plugin’s functionality is accessible through the object `cordova.plugins.saveDialog`.\n\n### saveFile\n\nCall this method to open the Save dialog and store raw contents in a file. The method accepts two arguments:\n\n* file contents as a Blob instance,\n* optional file name to display on default (the user may change it manually though).\n\nThe method returns a promise whose fulfillment value is a URI of the saved file in the user-selected location.\n\nTo construct a Blob representation for a file contents, either use the [`Blob` constructor](https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob) directly:\n\n```javascript\nlet blob = new Blob([\"file contents\"], {type: \"text/plain\"});\nlet fileName = \"my-file.txt\";\ncordova.plugins.saveDialog.saveFile(blob, fileName).then(uri =\u003e {\n  console.info(\"The file has been successfully saved to\", uri);\n}).catch(reason =\u003e {\n  console.warn(reason);\n});\n```\n\nor apply other methods of blob generation (such as [`Response.blob()`](https://developer.mozilla.org/en-US/docs/Web/API/Response/blob) for a network-fetched content):\n\n```javascript\ntry {\n  let response = await fetch(\"https://httpbin.org/image/jpeg\", {\n    headers: {Accept: \"image/jpeg\"}\n  });\n  let blob = await response.blob();\n  let uri = await cordova.plugins.saveDialog.saveFile(blob, \"jackal.jpeg\");\n  console.info(\"The file has been successfully saved to\", uri);\n} catch (e) {\n  console.error(e);\n}\n```\n\nDo not try to use the returned URI for getting file access. It is provided for information purposes only. The user stores a file outside the application sandbox, so access to the saved resource is to be considered restricted.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famphiluke%2Fcordova-plugin-save-dialog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famphiluke%2Fcordova-plugin-save-dialog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famphiluke%2Fcordova-plugin-save-dialog/lists"}