alpha0010 / react-native-file-access

Filesystem access for React Native
MIT License
307 stars 19 forks source link

Feature Request: Write File from Buffer #6

Closed lucsoft closed 3 years ago

alpha0010 commented 3 years ago

Could you describe how this is different than the existing FileSystem.writeFile(path: string, data: string)?

lucsoft commented 3 years ago

Because data only can be string as the types says

alpha0010 commented 3 years ago

(Assuming referring to https://nodejs.org/api/buffer.html), does accepting base 64 encoded strings meet your goal? Buffer is not included in the base React Native (of course, users can add it as a dependency), so potentially a user would have a different source of binary data.

So for example if using Buffer, the api call could be something like FileSystem.writeFile(path, buf.toString('base64'), 'base64')?

alpha0010 commented 3 years ago

Done in 72da4f85243b35b332c026d7360bf704c8574841.