react-native-fetch-blob
react-native-fetch-blob copied to clipboard
File size reported from fs.stat does not match uploaded file size
RN: 0.54 RNFB: 0.10.8 iOS 11 (Simulator and device)
let clip.uri = assets-library://asset/asset.JPG?id=9DC79222-EC93-45CA-9891-5D91AEDC5F7C&ext=JPG
let fd = new FormData()
let stats = await RNFetchBlob.fs.stat(clip.uri)
fileSize = stats.size
fileObj = {
uri: clip.uri,
type: clip.type,
name: clip.name,
filename: clip.name,
data: RNFetchBlob.wrap(clip.uri),
}
fileuploadlist.push(fileObj)
fd.append(fileSize + "_" + timestamp, fileObj)
let localOptions = {
method: "POST",
headers: {
"Content-Type": undefined,
Accept: "application/json",
},
body: fd,
file: fileuploadlist
}
try {
return fetch(url, localOptions, callback)
} catch (e) {}
}
reported file size from fs.stat === 178,849 bytes actual uploaded file size === 395,394 bytes
It seems that RNFetchBlob is uploading an uncompressed version of the file. Is there a way to make RNFetchBlob either report the uncompressed size or better yet, upload the file that was stat'ed?