[native][utils-module] Implement file r/w operations
Summary:
Part of ENG-3408.
This diff implements asynchronous functions to read/write file from/to ArrayBuffer.
Depends on D7452
Test Plan:
In the native JS code (e.g. root.react.js):
const myArray = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); const dir = temporaryDirectoryPath; console.log('temp dir:', dir); await commUtilsModule.writeBufferToFile(dir + 'temp.dat', myArray.buffer); commUtilsModule.readBufferFromFile(dir + 'temp.dat').then(data => { console.log('read:', new Uint8Array(data)); });
The read value should be the same as initial array. Also checked existence of the file
For iOS:
- open [printed temp dir path] - check if file exists
- xxd [printed temp dir path]/temp.dat - checked if hex is equal to 01 02 ... 0a (myArray)
For Android:
- adb root && adb pull [temp dir]/temp.dat - then xxd that file
- adb shell su ; ls [temp dir]
Reviewers: marcin, kamil, inka
Reviewed By: kamil
Subscribers: ashoat, tomek, atul
Differential Revision: https://phab.comm.dev/D7485