react-native-blob-util 0.16.4 → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +29 -3
- package/Migration.md +41 -0
- package/README.md +13 -6
- package/android/build.gradle +19 -1
- package/android/src/main/java/com/ReactNativeBlobUtil/ReactNativeBlobUtilBody.java +6 -6
- package/android/src/main/java/com/ReactNativeBlobUtil/ReactNativeBlobUtilFS.java +12 -8
- package/android/src/main/java/com/ReactNativeBlobUtil/{ReactNativeBlobUtil.java → ReactNativeBlobUtilImpl.java} +19 -78
- package/android/src/main/java/com/ReactNativeBlobUtil/ReactNativeBlobUtilMediaCollection.java +5 -5
- package/android/src/main/java/com/ReactNativeBlobUtil/ReactNativeBlobUtilPackage.java +31 -21
- package/android/src/main/java/com/ReactNativeBlobUtil/ReactNativeBlobUtilReq.java +22 -21
- package/android/src/main/java/com/ReactNativeBlobUtil/ReactNativeBlobUtilStream.java +6 -6
- package/android/src/main/java/com/ReactNativeBlobUtil/ReactNativeBlobUtilUtils.java +2 -2
- package/android/src/main/java/com/ReactNativeBlobUtil/Utils/MimeType.java +1 -1
- package/android/src/newarch/java/com/ReactNativeBlobUtil/ReactNativeBlobUtil.java +281 -0
- package/android/src/oldarch/java/com/ReactNativeBlobUtil/ReactNativeBlobUtil.java +242 -0
- package/android.js +2 -3
- package/class/ReactNativeBlobUtilFile.js +1 -13
- package/class/ReactNativeBlobUtilReadStream.js +1 -2
- package/class/ReactNativeBlobUtilSession.js +1 -2
- package/class/ReactNativeBlobUtilWriteStream.js +1 -3
- package/codegenSpecs/NativeBlobUtils.js +77 -0
- package/fetch.js +2 -2
- package/fs.js +22 -22
- package/index.d.ts +6 -0
- package/index.js +2 -2
- package/index.web.js +1 -0
- package/ios/ReactNativeBlobUtil/ReactNativeBlobUtil.h +10 -1
- package/ios/ReactNativeBlobUtil/{ReactNativeBlobUtil.m → ReactNativeBlobUtil.mm} +334 -41
- package/ios/{ReactNativeBlobUtilConst.m → ReactNativeBlobUtilConst.mm} +0 -0
- package/ios/ReactNativeBlobUtilFS.h +5 -5
- package/ios/{ReactNativeBlobUtilFS.m → ReactNativeBlobUtilFS.mm} +32 -26
- package/ios/{ReactNativeBlobUtilFileTransformer.m → ReactNativeBlobUtilFileTransformer.mm} +0 -0
- package/ios/ReactNativeBlobUtilNetwork.h +2 -2
- package/ios/{ReactNativeBlobUtilNetwork.m → ReactNativeBlobUtilNetwork.mm} +15 -17
- package/ios/{ReactNativeBlobUtilProgress.m → ReactNativeBlobUtilProgress.mm} +4 -4
- package/ios/{ReactNativeBlobUtilReqBuilder.m → ReactNativeBlobUtilReqBuilder.mm} +4 -4
- package/ios/ReactNativeBlobUtilRequest.h +4 -2
- package/ios/{ReactNativeBlobUtilRequest.m → ReactNativeBlobUtilRequest.mm} +16 -11
- package/ios.js +2 -3
- package/mediacollection.js +2 -4
- package/package.json +7 -2
- package/react-native-blob-util.podspec +21 -1
- package/examples/ReactNativeBlobUtil/.buckconfig +0 -6
- package/examples/ReactNativeBlobUtil/.eslintrc.js +0 -4
- package/examples/ReactNativeBlobUtil/.prettierrc.js +0 -6
- package/examples/ReactNativeBlobUtil/App.js +0 -698
- package/examples/ReactNativeBlobUtil/index.js +0 -9
- package/examples/ReactNativeBlobUtil/metro.config.js +0 -27
- package/examples/ReactNativeBlobUtil/package.json +0 -31
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/App.cpp +0 -80
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/App.h +0 -20
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/App.idl +0 -3
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/App.xaml +0 -10
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/Assets/LockScreenLogo.scale-200.png +0 -0
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/Assets/SplashScreen.scale-200.png +0 -0
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/Assets/Square150x150Logo.scale-200.png +0 -0
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/Assets/Square44x44Logo.scale-200.png +0 -0
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/Assets/Square44x44Logo.targetsize-24_altform-unplated.png +0 -0
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/Assets/StoreLogo.png +0 -0
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/Assets/Wide310x150Logo.scale-200.png +0 -0
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/AutolinkedNativeModules.g.cpp +0 -18
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/AutolinkedNativeModules.g.h +0 -10
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/AutolinkedNativeModules.g.targets +0 -11
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/MainPage.cpp +0 -24
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/MainPage.h +0 -21
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/MainPage.idl +0 -8
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/MainPage.xaml +0 -16
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/Package.appxmanifest +0 -50
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/PropertySheet.props +0 -16
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/ReactNativeBlobUtilWin.vcxproj +0 -196
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/ReactNativeBlobUtilWin.vcxproj.filters +0 -65
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/ReactNativeBlobUtilWin_TemporaryKey.pfx +0 -0
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/ReactPackageProvider.cpp +0 -18
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/ReactPackageProvider.h +0 -15
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/packages.config +0 -5
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/pch.cpp +0 -1
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin/pch.h +0 -26
- package/examples/ReactNativeBlobUtil/windows/ReactNativeBlobUtilWin.sln +0 -207
|
@@ -1,698 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sample React Native App
|
|
3
|
-
* https://github.com/facebook/react-native
|
|
4
|
-
*
|
|
5
|
-
* @format
|
|
6
|
-
* @flow strict-local
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import React, {useState} from 'react';
|
|
10
|
-
import {SafeAreaView, StyleSheet, ScrollView, View, Text, StatusBar, TextInput, Button, Alert, Picker} from 'react-native';
|
|
11
|
-
|
|
12
|
-
import {Colors} from 'react-native/Libraries/NewAppScreen';
|
|
13
|
-
|
|
14
|
-
import ReactNativeBlobUtil from 'react-native-blob-util';
|
|
15
|
-
|
|
16
|
-
const App: () => React$Node = () => {
|
|
17
|
-
// Variables ******************************************************************
|
|
18
|
-
const [existsParam, setExistsParam] = useState('');
|
|
19
|
-
const [lsParam, setLSParam] = useState('');
|
|
20
|
-
|
|
21
|
-
const [cpSourceParam, setCPSourceParam] = useState('');
|
|
22
|
-
const [cpDestParam, setCPDestParam] = useState('');
|
|
23
|
-
|
|
24
|
-
const [unlinkParam, setUnlinkParam] = useState('');
|
|
25
|
-
|
|
26
|
-
const [statParam, setStatParam] = useState('');
|
|
27
|
-
|
|
28
|
-
const [mkdirParam, setMkdirParam] = useState('');
|
|
29
|
-
const [mkdirURIParam, setMkdirURIParam] = useState('');
|
|
30
|
-
|
|
31
|
-
const [readParam, setReadParam] = useState('');
|
|
32
|
-
|
|
33
|
-
const [hashPathParam, setHashPathParam] = useState('');
|
|
34
|
-
const [hashAlgValue, setHashAlgValue] = useState('md5');
|
|
35
|
-
|
|
36
|
-
const [writeParam, setWriteParam] = useState('');
|
|
37
|
-
const [writeURIParam, setWriteURIParam] = useState('');
|
|
38
|
-
const [writeEncodeParam, setWriteEncodeParam] = useState('utf8');
|
|
39
|
-
|
|
40
|
-
const [writeStreamParam, setWriteStreamParam] = useState('');
|
|
41
|
-
const [writeEncodeStreamParam, setWriteStreamEncodeParam] = useState('utf8');
|
|
42
|
-
|
|
43
|
-
const [readStreamParam, setReadStreamParam] = useState('');
|
|
44
|
-
const [readEncodeStreamParam, setReadStreamEncodeParam] = useState('utf8');
|
|
45
|
-
|
|
46
|
-
// Methods ********************************************************************
|
|
47
|
-
// exists()
|
|
48
|
-
const existsCall = () => {
|
|
49
|
-
ReactNativeBlobUtil.fs
|
|
50
|
-
.exists(ReactNativeBlobUtil.fs.dirs.DocumentDir + '/' + existsParam)
|
|
51
|
-
.then((result) => {
|
|
52
|
-
Alert.alert('Exists: ' + result);
|
|
53
|
-
})
|
|
54
|
-
.catch((err) => {
|
|
55
|
-
Alert.alert(err.message);
|
|
56
|
-
});
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
const isDirCall = () => {
|
|
60
|
-
ReactNativeBlobUtil.fs
|
|
61
|
-
.exists(ReactNativeBlobUtil.fs.dirs.DocumentDir + '/' + existsParam)
|
|
62
|
-
.then((result) => {
|
|
63
|
-
Alert.alert('isDir: ' + result);
|
|
64
|
-
})
|
|
65
|
-
.catch((err) => {
|
|
66
|
-
Alert.alert(err.message);
|
|
67
|
-
});
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
// df()
|
|
71
|
-
const dfCall = () => {
|
|
72
|
-
ReactNativeBlobUtil.fs
|
|
73
|
-
.df()
|
|
74
|
-
.then((result) => {
|
|
75
|
-
Alert.alert('Free space: ' + result.free + ' bytes\nTotal space: ' + result.total + ' bytes');
|
|
76
|
-
})
|
|
77
|
-
.catch((err) => {
|
|
78
|
-
Alert.alert(err.message);
|
|
79
|
-
});
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
// ls()
|
|
83
|
-
const lsCall = () => {
|
|
84
|
-
ReactNativeBlobUtil.fs.ls(ReactNativeBlobUtil.fs.dirs.DocumentDir + '/' + lsParam).then((files) => {
|
|
85
|
-
Alert.alert('Method finished: check debug console for results');
|
|
86
|
-
console.log(files);
|
|
87
|
-
});
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
// cp()
|
|
91
|
-
const cpCall = () => {
|
|
92
|
-
ReactNativeBlobUtil.fs
|
|
93
|
-
.cp(ReactNativeBlobUtil.fs.dirs.DocumentDir + '/' + cpSourceParam, ReactNativeBlobUtil.fs.dirs.DocumentDir + '/' + cpDestParam)
|
|
94
|
-
.then(Alert.alert('File successfully copied'))
|
|
95
|
-
.catch((err) => {
|
|
96
|
-
Alert.alert(err.message);
|
|
97
|
-
});
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
// mv()
|
|
101
|
-
const mvCall = () => {
|
|
102
|
-
ReactNativeBlobUtil.fs
|
|
103
|
-
.mv(ReactNativeBlobUtil.fs.dirs.DocumentDir + '/' + cpSourceParam, ReactNativeBlobUtil.fs.dirs.DocumentDir + '/' + cpDestParam)
|
|
104
|
-
.then(Alert.alert('File successfully moved'))
|
|
105
|
-
.catch((err) => {
|
|
106
|
-
Alert.alert(err.message);
|
|
107
|
-
});
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
// unlink()
|
|
111
|
-
const unlinkCall = () => {
|
|
112
|
-
ReactNativeBlobUtil.fs
|
|
113
|
-
.unlink(ReactNativeBlobUtil.fs.dirs.DocumentDir + '/' + unlinkParam)
|
|
114
|
-
.then(Alert.alert('file/directory successfully unlinked'))
|
|
115
|
-
.catch((err) => {
|
|
116
|
-
Alert.alert(err.message);
|
|
117
|
-
});
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
// stat(), lstat()
|
|
121
|
-
const statCall = () => {
|
|
122
|
-
ReactNativeBlobUtil.fs
|
|
123
|
-
.stat(ReactNativeBlobUtil.fs.dirs.DocumentDir + '/' + statParam)
|
|
124
|
-
.then((stats) => {
|
|
125
|
-
console.log(stats);
|
|
126
|
-
Alert.alert('stat() result (others logged in console)', 'filename: ' + stats.filename + '\nlastModified: ' + stats.lastModified + '\npath: ' + stats.path + '\nsize: ' + stats.size + '\ntype: ' + stats.type);
|
|
127
|
-
})
|
|
128
|
-
.catch((err) => {
|
|
129
|
-
Alert.alert(err.message);
|
|
130
|
-
});
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
const lstatCall = () => {
|
|
134
|
-
ReactNativeBlobUtil.fs
|
|
135
|
-
.lstat(ReactNativeBlobUtil.fs.dirs.DocumentDir + '/' + statParam)
|
|
136
|
-
.then((stats) => {
|
|
137
|
-
console.log(stats);
|
|
138
|
-
Alert.alert('lstat() result (others logged in console)', 'filename: ' + stats[0].filename + '\nlastModified: ' + stats[0].lastModified + '\npath: ' + stats[0].path + '\nsize: ' + stats[0].size + '\ntype: ' + stats[0].type);
|
|
139
|
-
})
|
|
140
|
-
.catch((err) => {
|
|
141
|
-
Alert.alert(err.message);
|
|
142
|
-
});
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
// mkdir()
|
|
146
|
-
const mkdirCall = () => {
|
|
147
|
-
if (mkdirParam.length > 0) {
|
|
148
|
-
ReactNativeBlobUtil.fs
|
|
149
|
-
.mkdir(ReactNativeBlobUtil.fs.dirs.DocumentDir + '/' + mkdirParam)
|
|
150
|
-
.then(() => {
|
|
151
|
-
Alert.alert('successfully created file:', ReactNativeBlobUtil.fs.dirs.DocumentDir + '/' + mkdirParam);
|
|
152
|
-
})
|
|
153
|
-
.catch((err) => {
|
|
154
|
-
Alert.alert(err.message);
|
|
155
|
-
});
|
|
156
|
-
} else {
|
|
157
|
-
Alert.alert('Cannot make file with no name provided');
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
// createFile()
|
|
162
|
-
const createFileUTF8Call = () => {
|
|
163
|
-
ReactNativeBlobUtil.fs.createFile(ReactNativeBlobUtil.fs.dirs.DocumentDir + '/' + mkdirParam, 'foo', 'utf8');
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
const createFileASCIICall = () => {
|
|
167
|
-
ReactNativeBlobUtil.fs.createFile(ReactNativeBlobUtil.fs.dirs.DocumentDir + '/' + mkdirParam, [102, 111, 111], 'ascii');
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
const createFileBase64Call = () => {
|
|
171
|
-
ReactNativeBlobUtil.fs.createFile(ReactNativeBlobUtil.fs.dirs.DocumentDir + '/' + mkdirParam, 'Zm9v', 'base64');
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
const createFileURICall = () => {
|
|
175
|
-
ReactNativeBlobUtil.fs.createFile(ReactNativeBlobUtil.fs.dirs.DocumentDir + '/' + mkdirParam, ReactNativeBlobUtil.fs.dirs.DocumentDir + '/' + mkdirURIParam, 'uri');
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
// readFile()
|
|
179
|
-
const readFileUTF8Call = () => {
|
|
180
|
-
ReactNativeBlobUtil.fs.readFile(ReactNativeBlobUtil.fs.dirs.DocumentDir + '/' + readParam, 'utf8').then((data) => {
|
|
181
|
-
Alert.alert('UTF8 result of ' + readParam, data);
|
|
182
|
-
});
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
const readFileASCIICall = () => {
|
|
186
|
-
ReactNativeBlobUtil.fs.readFile(ReactNativeBlobUtil.fs.dirs.DocumentDir + '/' + readParam, 'ascii').then((data) => {
|
|
187
|
-
Alert.alert('UTF8 result of ' + readParam, data);
|
|
188
|
-
});
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
const readFileBase64Call = () => {
|
|
192
|
-
ReactNativeBlobUtil.fs.readFile(ReactNativeBlobUtil.fs.dirs.DocumentDir + '/' + readParam, 'base64').then((data) => {
|
|
193
|
-
Alert.alert('UTF8 result of ' + readParam, data);
|
|
194
|
-
});
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
// hash()
|
|
198
|
-
const hashCall = () => {
|
|
199
|
-
ReactNativeBlobUtil.fs
|
|
200
|
-
.hash(ReactNativeBlobUtil.fs.dirs.DocumentDir + '/' + hashPathParam, hashAlgValue)
|
|
201
|
-
.then((hash) => {
|
|
202
|
-
Alert.alert(hashAlgValue, hash);
|
|
203
|
-
})
|
|
204
|
-
.catch((err) => {
|
|
205
|
-
console.log(hashAlgValue + ': ' + err);
|
|
206
|
-
});
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
// writeFile()
|
|
210
|
-
const writeFileCall = () => {
|
|
211
|
-
if (writeParam.length > 0) {
|
|
212
|
-
if (writeEncodeParam === 'uri') {
|
|
213
|
-
if (writeURIParam.length > 0) {
|
|
214
|
-
ReactNativeBlobUtil.fs.writeFile(ReactNativeBlobUtil.fs.dirs.DocumentDir + '/' + writeParam, ReactNativeBlobUtil.fs.dirs.DocumentDir + '/' + writeURIParam, writeEncodeParam);
|
|
215
|
-
} else {
|
|
216
|
-
Alert.alert('uri path undefined');
|
|
217
|
-
}
|
|
218
|
-
} else if (writeEncodeParam === 'ascii') {
|
|
219
|
-
ReactNativeBlobUtil.fs.writeFile(ReactNativeBlobUtil.fs.dirs.DocumentDir + '/' + writeParam, [102, 111, 111], writeEncodeParam);
|
|
220
|
-
} else {
|
|
221
|
-
ReactNativeBlobUtil.fs.writeFile(ReactNativeBlobUtil.fs.dirs.DocumentDir + '/' + writeParam, 'foo', writeEncodeParam);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
};
|
|
225
|
-
|
|
226
|
-
// appendFile()
|
|
227
|
-
const appendFileCall = () => {
|
|
228
|
-
if (writeParam.length > 0) {
|
|
229
|
-
if (writeEncodeParam === 'uri') {
|
|
230
|
-
if (writeURIParam.length > 0) {
|
|
231
|
-
ReactNativeBlobUtil.fs.appendFile(ReactNativeBlobUtil.fs.dirs.DocumentDir + '/' + writeParam, ReactNativeBlobUtil.fs.dirs.DocumentDir + '/' + writeURIParam, writeEncodeParam);
|
|
232
|
-
} else {
|
|
233
|
-
Alert.alert('uri path undefined');
|
|
234
|
-
}
|
|
235
|
-
} else if (writeEncodeParam === 'ascii') {
|
|
236
|
-
ReactNativeBlobUtil.fs.appendFile(ReactNativeBlobUtil.fs.dirs.DocumentDir + '/' + writeParam, [102, 111, 111], writeEncodeParam);
|
|
237
|
-
} else {
|
|
238
|
-
ReactNativeBlobUtil.fs.appendFile(ReactNativeBlobUtil.fs.dirs.DocumentDir + '/' + writeParam, 'foo', writeEncodeParam);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
};
|
|
242
|
-
|
|
243
|
-
const writeStreamCall = () => {
|
|
244
|
-
if (writeStreamParam.length > 0) {
|
|
245
|
-
if (writeEncodeStreamParam === 'base64') {
|
|
246
|
-
ReactNativeBlobUtil.fs.writeStream(ReactNativeBlobUtil.fs.dirs.DocumentDir + '/' + writeStreamParam, writeEncodeStreamParam, false).then((stream) => {
|
|
247
|
-
stream.write('Zm9vIChXcml0ZSBCYXNlNjQpMQ==');
|
|
248
|
-
stream.write('Zm9vIChXcml0ZSBCYXNlNjQpMg==');
|
|
249
|
-
return stream.close();
|
|
250
|
-
});
|
|
251
|
-
} else if (writeEncodeStreamParam === 'ascii') {
|
|
252
|
-
ReactNativeBlobUtil.fs.writeStream(ReactNativeBlobUtil.fs.dirs.DocumentDir + '/' + writeStreamParam, writeEncodeStreamParam, false).then((stream) => {
|
|
253
|
-
stream.write([102, 111, 111, 32, 40, 87, 114, 105, 116]);
|
|
254
|
-
stream.write([101, 32, 97, 115, 99, 105, 105, 41]);
|
|
255
|
-
return stream.close();
|
|
256
|
-
});
|
|
257
|
-
} else {
|
|
258
|
-
ReactNativeBlobUtil.fs.writeStream(ReactNativeBlobUtil.fs.dirs.DocumentDir + '/' + writeStreamParam, writeEncodeStreamParam, false).then((stream) => {
|
|
259
|
-
stream.write('foo (Write utf8)1');
|
|
260
|
-
stream.write('foo (Write utf8)2');
|
|
261
|
-
return stream.close();
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
};
|
|
266
|
-
|
|
267
|
-
const appendStreamCall = () => {
|
|
268
|
-
if (writeStreamParam.length > 0) {
|
|
269
|
-
if (writeEncodeStreamParam === 'base64') {
|
|
270
|
-
ReactNativeBlobUtil.fs.writeStream(ReactNativeBlobUtil.fs.dirs.DocumentDir + '/' + writeStreamParam, writeEncodeStreamParam, true).then((stream) => {
|
|
271
|
-
stream.write('Zm9vIChBcHBlbmQgQmFzZTY0KTE=');
|
|
272
|
-
stream.write('Zm9vIChBcHBlbmQgQmFzZTY0KTI=');
|
|
273
|
-
return stream.close();
|
|
274
|
-
});
|
|
275
|
-
} else if (writeEncodeStreamParam === 'ascii') {
|
|
276
|
-
ReactNativeBlobUtil.fs.writeStream(ReactNativeBlobUtil.fs.dirs.DocumentDir + '/' + writeStreamParam, writeEncodeStreamParam, true).then((stream) => {
|
|
277
|
-
stream.write([102, 111, 111, 32, 40]);
|
|
278
|
-
stream.write([65, 112, 112, 101, 110, 100, 32, 65, 83, 67, 73, 73, 41]);
|
|
279
|
-
return stream.close();
|
|
280
|
-
});
|
|
281
|
-
} else {
|
|
282
|
-
ReactNativeBlobUtil.fs.writeStream(ReactNativeBlobUtil.fs.dirs.DocumentDir + '/' + writeStreamParam, writeEncodeStreamParam, true).then((stream) => {
|
|
283
|
-
stream.write('foo (Append utf8)1');
|
|
284
|
-
stream.write('foo (Append utf8)2');
|
|
285
|
-
return stream.close();
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
};
|
|
290
|
-
|
|
291
|
-
// readStream
|
|
292
|
-
const readStreamCall = () => {
|
|
293
|
-
ReactNativeBlobUtil.fs.readStream(ReactNativeBlobUtil.fs.dirs.DocumentDir + '/' + readStreamParam, readEncodeStreamParam, 4000, 200).then((stream) => {
|
|
294
|
-
let data = '';
|
|
295
|
-
stream.open();
|
|
296
|
-
stream.onData((chunk) => {
|
|
297
|
-
data += chunk;
|
|
298
|
-
});
|
|
299
|
-
stream.onEnd(() => {
|
|
300
|
-
console.log('data: ' + data);
|
|
301
|
-
});
|
|
302
|
-
});
|
|
303
|
-
};
|
|
304
|
-
|
|
305
|
-
// fetchCall
|
|
306
|
-
const fetchCall = () => {
|
|
307
|
-
ReactNativeBlobUtil.config({
|
|
308
|
-
// add this option that makes response data to be stored as a file,
|
|
309
|
-
// this is much more performant.
|
|
310
|
-
fileCache: true,
|
|
311
|
-
})
|
|
312
|
-
.fetch('GET', 'https://upload.wikimedia.org/wikipedia/commons/c/c4/Change-5.png')
|
|
313
|
-
.then((res) => {
|
|
314
|
-
// the temp file path
|
|
315
|
-
console.log('The file saved to ', res.path());
|
|
316
|
-
});
|
|
317
|
-
};
|
|
318
|
-
|
|
319
|
-
// uploadFileFromStorage
|
|
320
|
-
const uploadFromStorageCall = () => {
|
|
321
|
-
ReactNativeBlobUtil.fetch(
|
|
322
|
-
'POST',
|
|
323
|
-
'https://enb954aqyumba.x.pipedream.net/',
|
|
324
|
-
{
|
|
325
|
-
Authorization: 'Bearer access-token...',
|
|
326
|
-
'Dropbox-API-Arg': JSON.stringify({
|
|
327
|
-
path: '/img-from-react-native.png',
|
|
328
|
-
mode: 'add',
|
|
329
|
-
autorename: true,
|
|
330
|
-
mute: false,
|
|
331
|
-
}),
|
|
332
|
-
'Content-Type': 'application/octet-stream',
|
|
333
|
-
// here's the body you're going to send, should be a BASE64 encoded string
|
|
334
|
-
// (you can use "base64"(refer to the library 'mathiasbynens/base64') APIs to make one).
|
|
335
|
-
// The data will be converted to "byte array"(say, blob) before request sent.
|
|
336
|
-
},
|
|
337
|
-
ReactNativeBlobUtil.wrap(ReactNativeBlobUtil.fs.dirs.DocumentDir + '\\ImageToUpload.jpg'),
|
|
338
|
-
)
|
|
339
|
-
.then((res) => {
|
|
340
|
-
console.log(res.text());
|
|
341
|
-
})
|
|
342
|
-
.catch((err) => {
|
|
343
|
-
// error handling ..
|
|
344
|
-
});
|
|
345
|
-
};
|
|
346
|
-
|
|
347
|
-
// uploadTextFromStorage
|
|
348
|
-
const uploadTextFromCall = () => {
|
|
349
|
-
ReactNativeBlobUtil.fetch(
|
|
350
|
-
'POST',
|
|
351
|
-
'https://enb954aqyumba.x.pipedream.net/',
|
|
352
|
-
{
|
|
353
|
-
Authorization: 'Bearer access-token...',
|
|
354
|
-
'Dropbox-API-Arg': JSON.stringify({
|
|
355
|
-
path: '/img-from-react-native.png',
|
|
356
|
-
mode: 'add',
|
|
357
|
-
autorename: true,
|
|
358
|
-
mute: false,
|
|
359
|
-
}),
|
|
360
|
-
'Content-Type': 'application/octet-stream',
|
|
361
|
-
// here's the body you're going to send, should be a BASE64 encoded string
|
|
362
|
-
// (you can use "base64"(refer to the library 'mathiasbynens/base64') APIs to make one).
|
|
363
|
-
// The data will be converted to "byte array"(say, blob) before request sent.
|
|
364
|
-
},
|
|
365
|
-
'Waka Flacka Flame goes very well with Thomas the Tank Engine.',
|
|
366
|
-
)
|
|
367
|
-
.then((res) => {
|
|
368
|
-
console.log(res.text());
|
|
369
|
-
})
|
|
370
|
-
.catch((err) => {
|
|
371
|
-
// error handling ..
|
|
372
|
-
});
|
|
373
|
-
};
|
|
374
|
-
|
|
375
|
-
// MultipartFileAndData
|
|
376
|
-
const MultipartFileAndData = () => {
|
|
377
|
-
ReactNativeBlobUtil.fetch(
|
|
378
|
-
'POST',
|
|
379
|
-
'https://enb954aqyumba.x.pipedream.net/',
|
|
380
|
-
{
|
|
381
|
-
Authorization: 'Bearer access-token...',
|
|
382
|
-
'Dropbox-API-Arg': JSON.stringify({
|
|
383
|
-
path: '/img-from-react-native.png',
|
|
384
|
-
mode: 'add',
|
|
385
|
-
autorename: true,
|
|
386
|
-
mute: false,
|
|
387
|
-
}),
|
|
388
|
-
'Content-Type': 'application/octet-stream',
|
|
389
|
-
// here's the body you're going to send, should be a BASE64 encoded string
|
|
390
|
-
// (you can use "base64"(refer to the library 'mathiasbynens/base64') APIs to make one).
|
|
391
|
-
// The data will be converted to "byte array"(say, blob) before request sent.
|
|
392
|
-
},
|
|
393
|
-
'Waka Flacka Flame goes very well with Thomas the Tank Engine.',
|
|
394
|
-
)
|
|
395
|
-
.uploadProgress((received, total) => {
|
|
396
|
-
console.log('upload progress', received / total);
|
|
397
|
-
})
|
|
398
|
-
.progress((received, total) => {
|
|
399
|
-
console.log('download progress', received / total);
|
|
400
|
-
})
|
|
401
|
-
.then((res) => {
|
|
402
|
-
console.log(res.text());
|
|
403
|
-
})
|
|
404
|
-
.catch((err) => {
|
|
405
|
-
// error handling ..
|
|
406
|
-
});
|
|
407
|
-
};
|
|
408
|
-
|
|
409
|
-
//
|
|
410
|
-
const MakeRequestWithProgress = () => {
|
|
411
|
-
ReactNativeBlobUtil.config({
|
|
412
|
-
// add this option that makes response data to be stored as a file,
|
|
413
|
-
// this is much more performant.
|
|
414
|
-
fileCache: true,
|
|
415
|
-
})
|
|
416
|
-
.fetch(
|
|
417
|
-
'POST',
|
|
418
|
-
'https://enb954aqyumba.x.pipedream.net/',
|
|
419
|
-
{
|
|
420
|
-
Authorization: 'Bearer access-token',
|
|
421
|
-
otherHeader: 'foo',
|
|
422
|
-
'Content-Type': 'multipart/form-data',
|
|
423
|
-
},
|
|
424
|
-
[
|
|
425
|
-
// element with property `filename` will be transformed into `file` in form data
|
|
426
|
-
{name: 'avatar', filename: 'avatar.png', data: 'Kentucky Fried Seth'},
|
|
427
|
-
// custom content type
|
|
428
|
-
{name: 'avatar-png', filename: 'avatar-png.png', type: 'image/png', data: 'whaddup my pickles'},
|
|
429
|
-
// part file from storage
|
|
430
|
-
{name: 'avatar-foo', filename: 'avatar-foo.png', type: 'image/foo', data: ReactNativeBlobUtil.wrap(ReactNativeBlobUtil.fs.dirs.DocumentDir + '\\ImageToUpload.jpg')},
|
|
431
|
-
// elements without property `filename` will be sent as plain text
|
|
432
|
-
{name: 'name', data: 'user'},
|
|
433
|
-
{
|
|
434
|
-
name: 'info',
|
|
435
|
-
data: JSON.stringify({
|
|
436
|
-
mail: 'example@example.com',
|
|
437
|
-
tel: '12345678',
|
|
438
|
-
}),
|
|
439
|
-
},
|
|
440
|
-
],
|
|
441
|
-
)
|
|
442
|
-
.uploadProgress({interval: 250}, (written, total) => {
|
|
443
|
-
console.log('uploaded', written / total);
|
|
444
|
-
})
|
|
445
|
-
.progress({count: 10, interval: -1}, (received, total) => {
|
|
446
|
-
console.log('progress', received / total);
|
|
447
|
-
})
|
|
448
|
-
.then((res) => {
|
|
449
|
-
console.log(res.text());
|
|
450
|
-
})
|
|
451
|
-
.catch((err) => {
|
|
452
|
-
console.log(err.text());
|
|
453
|
-
});
|
|
454
|
-
};
|
|
455
|
-
|
|
456
|
-
// App ************************************************************************
|
|
457
|
-
return (
|
|
458
|
-
<>
|
|
459
|
-
<StatusBar barStyle="dark-content" />
|
|
460
|
-
<SafeAreaView>
|
|
461
|
-
<ScrollView contentInsetAdjustmentBehavior="automatic" style={styles.scrollView}>
|
|
462
|
-
{global.HermesInternal == null ? null : (
|
|
463
|
-
<View style={styles.engine}>
|
|
464
|
-
<Text style={styles.footer}>Engine: Hermes</Text>
|
|
465
|
-
</View>
|
|
466
|
-
)}
|
|
467
|
-
<Text style={styles.sectionTitle}>{'React Native Fetch Blob Windows Demo App'}</Text>
|
|
468
|
-
<View style={styles.body}>
|
|
469
|
-
<View style={styles.sectionContainer}>
|
|
470
|
-
<View style={styles.sectionDescription}>
|
|
471
|
-
<Text>
|
|
472
|
-
{'DocumentDir: ' + ReactNativeBlobUtil.fs.dirs.DocumentDir + '\n'}
|
|
473
|
-
{'CacheDir: ' + ReactNativeBlobUtil.fs.dirs.CacheDir + '\n'}
|
|
474
|
-
{'PictureDir: ' + ReactNativeBlobUtil.fs.dirs.PictureDir + '\n'}
|
|
475
|
-
{'MusicDir: ' + ReactNativeBlobUtil.fs.dirs.MusicDir + '\n'}
|
|
476
|
-
{'DownloadDir: ' + ReactNativeBlobUtil.fs.dirs.DownloadDir + '\n'}
|
|
477
|
-
{'DCIMDir: ' + ReactNativeBlobUtil.fs.dirs.DCIMDir + '\n'}
|
|
478
|
-
{'SDCardDir: ' + ReactNativeBlobUtil.fs.dirs.SDCardDir + '\n'}
|
|
479
|
-
{'SDCardApplicationDir: ' + ReactNativeBlobUtil.fs.dirs.SDCardApplicationDir + '\n'}
|
|
480
|
-
{'MainBundleDir: ' + ReactNativeBlobUtil.fs.dirs.MainBundleDir + '\n'}
|
|
481
|
-
{'LibraryDir: ' + ReactNativeBlobUtil.fs.dirs.LibraryDir + '\n'}
|
|
482
|
-
</Text>
|
|
483
|
-
</View>
|
|
484
|
-
</View>
|
|
485
|
-
</View>
|
|
486
|
-
|
|
487
|
-
<View style={styles.body}>
|
|
488
|
-
<View style={styles.sectionContainer}>
|
|
489
|
-
<Text style={styles.sectionTitle}>{'exists - exists(), isDir()'}</Text>
|
|
490
|
-
<TextInput style={styles.input} placeholder="Path" onChangeText={(existsParam) => setExistsParam(existsParam)} placeholderTextColor="#9a73ef" autoCapitalize="none" />
|
|
491
|
-
<Button title="Check if exists" color="#9a73ef" onPress={existsCall} />
|
|
492
|
-
<Button title="Check if is dir" color="#9a73ef" onPress={isDirCall} />
|
|
493
|
-
</View>
|
|
494
|
-
</View>
|
|
495
|
-
|
|
496
|
-
<View style={styles.body}>
|
|
497
|
-
<View style={styles.sectionContainer}>
|
|
498
|
-
<Text style={styles.sectionTitle}>{'df - df()'}</Text>
|
|
499
|
-
<Button title="Get free/total disk space" color="#9a73ef" onPress={dfCall} />
|
|
500
|
-
</View>
|
|
501
|
-
</View>
|
|
502
|
-
|
|
503
|
-
<View style={styles.body}>
|
|
504
|
-
<View style={styles.sectionContainer}>
|
|
505
|
-
<Text style={styles.sectionTitle}>{'ls - ls()'}</Text>
|
|
506
|
-
<View style={styles.sectionDescription}>
|
|
507
|
-
<TextInput style={styles.input} placeholder="Directory Path" onChangeText={(lsParam) => setLSParam(lsParam)} placeholderTextColor="#9a73ef" autoCapitalize="none" />
|
|
508
|
-
</View>
|
|
509
|
-
<Button title="Get specified directory info" color="#9a73ef" onPress={lsCall} />
|
|
510
|
-
</View>
|
|
511
|
-
</View>
|
|
512
|
-
|
|
513
|
-
<View style={styles.body}>
|
|
514
|
-
<View style={styles.sectionContainer}>
|
|
515
|
-
<Text style={styles.sectionTitle}>{'cp and mv - cp() and mv()'}</Text>
|
|
516
|
-
<View style={styles.sectionDescription}>
|
|
517
|
-
<TextInput style={styles.input} placeholder="Source File Path" onChangeText={(cpSourceParam) => setCPSourceParam(cpSourceParam)} placeholderTextColor="#9a73ef" autoCapitalize="none" />
|
|
518
|
-
<TextInput style={styles.input} placeholder="Destintation File Path" onChangeText={(cpDestParam) => setCPDestParam(cpDestParam)} placeholderTextColor="#9a73ef" autoCapitalize="none" />
|
|
519
|
-
</View>
|
|
520
|
-
<Button title="Copy File to Destination" color="#9a73ef" onPress={cpCall} />
|
|
521
|
-
<Button title="Move File to Destination" color="#9a73ef" onPress={mvCall} />
|
|
522
|
-
</View>
|
|
523
|
-
</View>
|
|
524
|
-
|
|
525
|
-
<View style={styles.body}>
|
|
526
|
-
<View style={styles.sectionContainer}>
|
|
527
|
-
<Text style={styles.sectionTitle}>{'unlink - unlink()'}</Text>
|
|
528
|
-
<View style={styles.sectionDescription}>
|
|
529
|
-
<TextInput style={styles.input} placeholder="File Path" onChangeText={(unlinkParam) => setUnlinkParam(unlinkParam)} placeholderTextColor="#9a73ef" autoCapitalize="none" />
|
|
530
|
-
</View>
|
|
531
|
-
<Button title="Copy File to Destination" color="#9a73ef" onPress={unlinkCall} />
|
|
532
|
-
</View>
|
|
533
|
-
</View>
|
|
534
|
-
|
|
535
|
-
<View style={styles.body}>
|
|
536
|
-
<View style={styles.sectionContainer}>
|
|
537
|
-
<Text style={styles.sectionTitle}>{'stat - stat(), lstat()'}</Text>
|
|
538
|
-
<View style={styles.sectionDescription}>
|
|
539
|
-
<TextInput style={styles.input} placeholder="Source path" onChangeText={(statParam) => setStatParam(statParam)} placeholderTextColor="#9a73ef" autoCapitalize="none" />
|
|
540
|
-
</View>
|
|
541
|
-
<Button title="stat Call" color="#9a73ef" onPress={statCall} />
|
|
542
|
-
<Button title="lstat Call" color="#9a73ef" onPress={lstatCall} />
|
|
543
|
-
</View>
|
|
544
|
-
</View>
|
|
545
|
-
|
|
546
|
-
<View style={styles.body}>
|
|
547
|
-
<View style={styles.sectionContainer}>
|
|
548
|
-
<Text style={styles.sectionTitle}>{'mkdir - mkdir(), createFile()'}</Text>
|
|
549
|
-
<View style={styles.sectionDescription}>
|
|
550
|
-
<TextInput style={styles.input} placeholder="Source path" onChangeText={(mkdirParam) => setMkdirParam(mkdirParam)} placeholderTextColor="#9a73ef" autoCapitalize="none" />
|
|
551
|
-
<TextInput style={styles.input} placeholder="URI source path" onChangeText={(mkdirURIParam) => setMkdirURIParam(mkdirURIParam)} placeholderTextColor="#9a73ef" autoCapitalize="none" />
|
|
552
|
-
</View>
|
|
553
|
-
<Button title="mkdir" color="#9a73ef" onPress={mkdirCall} />
|
|
554
|
-
<Button title="Create UTF8 file" color="#9a73ef" onPress={createFileUTF8Call} />
|
|
555
|
-
<Button title="Create ASCII file" color="#9a73ef" onPress={createFileASCIICall} />
|
|
556
|
-
<Button title="Create base64 file" color="#9a73ef" onPress={createFileBase64Call} />
|
|
557
|
-
<Button title="Create file from URI" color="#9a73ef" onPress={createFileURICall} />
|
|
558
|
-
</View>
|
|
559
|
-
</View>
|
|
560
|
-
|
|
561
|
-
<View style={styles.body}>
|
|
562
|
-
<View style={styles.sectionContainer}>
|
|
563
|
-
<Text style={styles.sectionTitle}>{'readFile - readFile()'}</Text>
|
|
564
|
-
<View style={styles.sectionDescription}>
|
|
565
|
-
<TextInput style={styles.input} placeholder="Source path" onChangeText={(readParam) => setReadParam(readParam)} placeholderTextColor="#9a73ef" autoCapitalize="none" />
|
|
566
|
-
</View>
|
|
567
|
-
<Button title="Read UTF8 file" color="#9a73ef" onPress={readFileUTF8Call} />
|
|
568
|
-
<Button title="Read ASCII file" color="#9a73ef" onPress={readFileASCIICall} />
|
|
569
|
-
<Button title="Read base64 file" color="#9a73ef" onPress={readFileBase64Call} />
|
|
570
|
-
</View>
|
|
571
|
-
</View>
|
|
572
|
-
|
|
573
|
-
<View style={styles.body}>
|
|
574
|
-
<View style={styles.sectionContainer}>
|
|
575
|
-
<Text style={styles.sectionTitle}>{'Hash - hash()'}</Text>
|
|
576
|
-
<View style={styles.sectionDescription}>
|
|
577
|
-
<TextInput style={styles.input} placeholder="Source path" onChangeText={(hashPathParam) => setHashPathParam(hashPathParam)} placeholderTextColor="#9a73ef" autoCapitalize="none" />
|
|
578
|
-
<Picker hashAlgValue={hashAlgValue} onChangeText={(readPositionParam) => setReadPositionParam(readPositionParam)} style={{height: 50, width: 150}} onValueChange={(itemValue, itemIndex) => setHashAlgValue(itemValue)}>
|
|
579
|
-
<Picker.Item label="MD5" value="md5" />
|
|
580
|
-
<Picker.Item label="SHA1" value="sha1" />
|
|
581
|
-
<Picker.Item label="SHA224" value="sha224" />
|
|
582
|
-
<Picker.Item label="SHA256" value="sha256" />
|
|
583
|
-
<Picker.Item label="SHA384" value="sha384" />
|
|
584
|
-
<Picker.Item label="SHA512" value="sha512" />
|
|
585
|
-
</Picker>
|
|
586
|
-
</View>
|
|
587
|
-
<Button title="Hash File" color="#9a73ef" onPress={hashCall} />
|
|
588
|
-
</View>
|
|
589
|
-
</View>
|
|
590
|
-
|
|
591
|
-
<View style={styles.body}>
|
|
592
|
-
<View style={styles.sectionContainer}>
|
|
593
|
-
<Text style={styles.sectionTitle}>{'write - writeFile(), appendFile()'}</Text>
|
|
594
|
-
<View style={styles.sectionDescription}>
|
|
595
|
-
<TextInput style={styles.input} placeholder="Source path" onChangeText={(writeParam) => setWriteParam(writeParam)} placeholderTextColor="#9a73ef" autoCapitalize="none" />
|
|
596
|
-
<TextInput style={styles.input} placeholder="Source path" onChangeText={(writeURIParam) => setWriteURIParam(writeURIParam)} placeholderTextColor="#9a73ef" autoCapitalize="none" />
|
|
597
|
-
<Picker writeEncodeStreamParam={writeEncodeParam} onChangeText={(readPositionParam) => setReadPositionParam(readPositionParam)} style={{height: 50, width: 150}} onValueChange={(itemValue, itemIndex) => setWriteEncodeParam(itemValue)}>
|
|
598
|
-
<Picker.Item label="UTF8" value="utf8" />
|
|
599
|
-
<Picker.Item label="Base64" value="base64" />
|
|
600
|
-
<Picker.Item label="ASCII" value="ascii" />
|
|
601
|
-
<Picker.Item label="URI" value="uri" />
|
|
602
|
-
</Picker>
|
|
603
|
-
</View>
|
|
604
|
-
<Button title="Write" color="#9a73ef" onPress={writeFileCall} />
|
|
605
|
-
<Button title="Append" color="#9a73ef" onPress={appendFileCall} />
|
|
606
|
-
</View>
|
|
607
|
-
</View>
|
|
608
|
-
|
|
609
|
-
<View style={styles.body}>
|
|
610
|
-
<View style={styles.sectionContainer}>
|
|
611
|
-
<Text style={styles.sectionTitle}>{'WriteStream - writeStream()'}</Text>
|
|
612
|
-
<View style={styles.sectionDescription}>
|
|
613
|
-
<TextInput style={styles.input} placeholder="Source path" onChangeText={(writeStreamParam) => setWriteStreamParam(writeStreamParam)} placeholderTextColor="#9a73ef" autoCapitalize="none" />
|
|
614
|
-
|
|
615
|
-
<Picker writeEncodeStreamParam={writeEncodeStreamParam} onChangeText={(readPositionParam) => setReadPositionParam(readPositionParam)} style={{height: 50, width: 150}} onValueChange={(itemValue, itemIndex) => setWriteStreamEncodeParam(itemValue)}>
|
|
616
|
-
<Picker.Item label="UTF8" value="utf8" />
|
|
617
|
-
<Picker.Item label="Base64" value="base64" />
|
|
618
|
-
<Picker.Item label="ASCII" value="ascii" />
|
|
619
|
-
</Picker>
|
|
620
|
-
</View>
|
|
621
|
-
<Button title="Write" color="#9a73ef" onPress={writeStreamCall} />
|
|
622
|
-
<Button title="Append" color="#9a73ef" onPress={appendStreamCall} />
|
|
623
|
-
</View>
|
|
624
|
-
</View>
|
|
625
|
-
|
|
626
|
-
<View style={styles.body}>
|
|
627
|
-
<View style={styles.sectionContainer}>
|
|
628
|
-
<Text style={styles.sectionTitle}>{'ReadStream - readStream()'}</Text>
|
|
629
|
-
<View style={styles.sectionDescription}>
|
|
630
|
-
<TextInput style={styles.input} placeholder="Source path" onChangeText={(readStreamParam) => setReadStreamParam(readStreamParam)} placeholderTextColor="#9a73ef" autoCapitalize="none" />
|
|
631
|
-
|
|
632
|
-
<Picker readEncodeStreamParam={readEncodeStreamParam} onChangeText={(readPositionParam) => setReadPositionParam(readPositionParam)} style={{height: 50, width: 150}} onValueChange={(itemValue, itemIndex) => setReadStreamEncodeParam(itemValue)}>
|
|
633
|
-
<Picker.Item label="UTF8" value="utf8" />
|
|
634
|
-
<Picker.Item label="Base64" value="base64" />
|
|
635
|
-
<Picker.Item label="ASCII" value="ascii" />
|
|
636
|
-
</Picker>
|
|
637
|
-
</View>
|
|
638
|
-
<Button title="Read" color="#9a73ef" onPress={readStreamCall} />
|
|
639
|
-
</View>
|
|
640
|
-
</View>
|
|
641
|
-
|
|
642
|
-
<View style={styles.body}>
|
|
643
|
-
<View style={styles.sectionContainer}>
|
|
644
|
-
<Text style={styles.sectionTitle}>{'FetchBlobTest'}</Text>
|
|
645
|
-
<View style={styles.sectionDescription} />
|
|
646
|
-
<Button title="Attempt Fetch" color="#9a73ef" onPress={fetchCall} />
|
|
647
|
-
<Button title="Upload File from Storage" color="#9a73ef" onPress={uploadFromStorageCall} />
|
|
648
|
-
<Button title="Upload Text From Storage" color="#9a73ef" onPress={uploadTextFromCall} />
|
|
649
|
-
<Button title="Multipart Call" color="#9a73ef" onPress={MultipartFileAndData} />
|
|
650
|
-
<Button title="Progress Call" color="#9a73ef" onPress={MakeRequestWithProgress} />
|
|
651
|
-
</View>
|
|
652
|
-
</View>
|
|
653
|
-
</ScrollView>
|
|
654
|
-
</SafeAreaView>
|
|
655
|
-
</>
|
|
656
|
-
);
|
|
657
|
-
};
|
|
658
|
-
|
|
659
|
-
const styles = StyleSheet.create({
|
|
660
|
-
scrollView: {
|
|
661
|
-
backgroundColor: Colors.black,
|
|
662
|
-
},
|
|
663
|
-
engine: {
|
|
664
|
-
position: 'absolute',
|
|
665
|
-
right: 0,
|
|
666
|
-
},
|
|
667
|
-
body: {
|
|
668
|
-
backgroundColor: Colors.dark,
|
|
669
|
-
},
|
|
670
|
-
sectionContainer: {
|
|
671
|
-
marginTop: 32,
|
|
672
|
-
paddingHorizontal: 24,
|
|
673
|
-
},
|
|
674
|
-
sectionTitle: {
|
|
675
|
-
fontSize: 24,
|
|
676
|
-
fontWeight: '600',
|
|
677
|
-
color: Colors.white,
|
|
678
|
-
},
|
|
679
|
-
sectionDescription: {
|
|
680
|
-
marginTop: 8,
|
|
681
|
-
fontSize: 18,
|
|
682
|
-
fontWeight: '400',
|
|
683
|
-
color: Colors.dark,
|
|
684
|
-
},
|
|
685
|
-
highlight: {
|
|
686
|
-
fontWeight: '700',
|
|
687
|
-
},
|
|
688
|
-
footer: {
|
|
689
|
-
color: Colors.dark,
|
|
690
|
-
fontSize: 12,
|
|
691
|
-
fontWeight: '600',
|
|
692
|
-
padding: 4,
|
|
693
|
-
paddingRight: 12,
|
|
694
|
-
textAlign: 'right',
|
|
695
|
-
},
|
|
696
|
-
});
|
|
697
|
-
|
|
698
|
-
export default App;
|