MCPcopy Create free account
hub / github.com/itinance/react-native-fs / read

Method read

android/src/main/java/com/rnfs/RNFSManager.java:236–251  ·  view source on GitHub ↗
(String filepath, int length, int position, Promise promise)

Source from the content-addressed store, hash-verified

234 }
235
236 @ReactMethod
237 public void read(String filepath, int length, int position, Promise promise) {
238 try {
239 InputStream inputStream = getInputStream(filepath);
240 byte[] buffer = new byte[length];
241 inputStream.skip(position);
242 int bytesRead = inputStream.read(buffer, 0, length);
243
244 String base64Content = Base64.encodeToString(buffer, 0, bytesRead, Base64.NO_WRAP);
245
246 promise.resolve(base64Content);
247 } catch (Exception ex) {
248 ex.printStackTrace();
249 reject(promise, filepath, ex);
250 }
251 }
252
253 @ReactMethod
254 public void readFileAssets(String filepath, Promise promise) {

Callers 7

getInputStreamBytesMethod · 0.45
readFileAssetsMethod · 0.45
readFileResMethod · 0.45
hashMethod · 0.45
doInBackgroundMethod · 0.45
copyInputStreamMethod · 0.45
downloadMethod · 0.45

Calls 2

getInputStreamMethod · 0.95
rejectMethod · 0.95

Tested by

no test coverage detected