Skip to content

feat(file-transform-support): use blob-util's transform file support#1017

Open
yittoo wants to merge 2 commits into
wonday:masterfrom
yittoo:file-transform-support
Open

feat(file-transform-support): use blob-util's transform file support#1017
yittoo wants to merge 2 commits into
wonday:masterfrom
yittoo:file-transform-support

Conversation

@yittoo
Copy link
Copy Markdown

@yittoo yittoo commented May 8, 2026

Follow up on #1016

Context:

  • Underlying library react-native-blob-util provides support for transforming files this can be used
  • This provides on-device file encryption/decryption for sensitive files
  • This also can be used other use cases depending on projects outside of encryption scope

Implementation:

  • introduce new prop boolean transformFile
  • if false, same as current behaviour
  • true, it uses transform upon read/write during blob-util operations, handles cleanup of decrypted file on unmount

Side thoughts:

  • perhaps an alternative approach can be transformFileWrite / transformFileRead, so this can optionally be enabled per write/read basis, up for suggestions around that, I found it unnecessary since android/ios implementations of transform of blob-util has to be written explicitly anyways
  • I also included a cleanup for non cached files upon unmount, can remove it if not desired, but this library currently does not ever clean up cache files over long term itself, which is piling up in device storage, this should solve fraction of that problem for non cached ones at low cost.

Security risks:

  • For decrypted view file, if application crashes or closes during viewing the PDF, unless the same file is opened again, the view file is going to linger
  • Perhaps at a separate PR (to keep this one simple), it can be looked at to clean all .pdf.view files on mount for security purposes, but maybe naming can be more specific to library such as .pdf.rnpdfcache instead of .pdf.view so there is no mistakenly deletion of other stuff

I didn't edit README yet on how to use this in case requirements change or you want to write it yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant