react-native-blob-util icon indicating copy to clipboard operation
react-native-blob-util copied to clipboard

[Feature] iOS set file / folder attributes

Open cristianoccazinsp opened this issue 4 years ago • 1 comments

Hello,

We already have ReactNativeBlobUtil.ios.excludeFromBackupKey for iOS. It would be great to also have a way to change file attributes (e.g., to set NSFileProtectionKey on files and folders).

Thoughts on how to accomplish this? I guess we could copy something like this https://github.com/itinance/react-native-fs/blob/master/RNFSManager.m#L123

Rather than a new method, it could also be part of mkdir and writeFile. But if we want to follow the same idea of excludeFromBackupKey, it really has to be a new method

cristianoccazinsp avatar Jul 02 '21 17:07 cristianoccazinsp

Personally I prefer to not have to make multiple calls for first writing / moving a file and then setting the attribute (at least for the public api). But in general there should be the possibility to do it separately too.

Sadly I don't have the time to rework the whole library to clean such things up. But I would suggest the following:

  • Internally make a own method for it
  • Public a new method like "set file properties" to set e.g. NSURLIsExcludedFromBackupKey andNSFileProtectionKey
  • keep old method for combability reasons
  • new options for move / write to directly set the options

But I probably won't have time to implement this before august

RonRadtke avatar Jul 03 '21 06:07 RonRadtke