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

Method write

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

Source from the content-addressed store, hash-verified

186 }
187
188 @ReactMethod
189 public void write(String filepath, String base64Content, int position, Promise promise) {
190 try {
191 byte[] bytes = Base64.decode(base64Content, Base64.DEFAULT);
192
193 if (position < 0) {
194 OutputStream outputStream = getOutputStream(filepath, true);
195 outputStream.write(bytes);
196 outputStream.close();
197 } else {
198 RandomAccessFile file = new RandomAccessFile(filepath, "rw");
199 file.seek(position);
200 file.write(bytes);
201 file.close();
202 }
203
204 promise.resolve(null);
205 } catch (Exception ex) {
206 ex.printStackTrace();
207 reject(promise, filepath, ex);
208 }
209 }
210
211 @ReactMethod
212 public void exists(String filepath, Promise promise) {

Callers 6

getInputStreamBytesMethod · 0.45
writeFileMethod · 0.45
appendFileMethod · 0.45
doInBackgroundMethod · 0.45
copyInputStreamMethod · 0.45
downloadMethod · 0.45

Calls 2

getOutputStreamMethod · 0.95
rejectMethod · 0.95

Tested by

no test coverage detected