feat(storage-plugin): add file import/export to the file-system plugin #276
Draft
JKobrynski wants to merge 4 commits into
Draft
Conversation
Introduces opt-in file transfer capabilities and import/export message payloads for the file system plugin protocol. Adds raw base64 read/write support for Expo legacy, Expo modern, and RNFS adapters, including path existence checks used by overwrite handling. Also updates the public SDK exports, optional module typings, no-op adapter, and provider tests for transfer capability resolution and adapter behavior.
Adds fs:export-file and fs:import-file handlers on the React Native side. The handlers enforce the opt-in fileTransfer capabilities, resolve the active filesystem adapter, validate that paths stay inside configured roots, reject path traversal, and prevent importing over existing files unless overwrite is explicitly requested. Export reads files as base64 through the adapter and import writes base64 data back into the selected directory, returning structured result events for the panel to consume.
Adds panel-side request helpers for fs:export-file and fs:import-file, plus navigation state for the runtime-advertised file transfer capabilities. Adds browser utilities for reading selected files as base64 and downloading base64 responses as files. Wires the file system panel to import a single file into the current directory, ask before overwriting existing files, reload after successful writes, and surface transfer errors alongside existing filesystem errors. Adds an export action to the detail panel for selected files when export is enabled by the runtime.
Documents the opt-in file transfer capability for the file system plugin, including import/export setup for Expo and RNFS adapters. Calls out that transfer is disabled by default, supports single files only, imports into the currently viewed directory, and prompts before overwriting an existing file. Enables import/export in the playground app so the workflow can be exercised while developing the plugin.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue: #252
Summary
fs:export-file/fs:import-filerequest-result events.fileTransfer.importand/orfileTransfer.export.Test plan
Automated:
pnpm --filter @rozenite/file-system-plugin test— 32/32 passing.pnpm --filter @rozenite/file-system-plugin typecheck— clean.pnpm --filter @rozenite/file-system-plugin lint— clean.Manual:
fileTransferis not enabled.Out of scope