Rn-fetch-blob: wrap doesn't work with 'file://' prefix

Created on 28 Sep 2018  路  5Comments  路  Source: joltup/rn-fetch-blob

RN: 0.57.0
rn-fetch-blob: 0.10.13

Tested on iOS. Not sure about android.

var path = 'file:///var/mobile/Containers/Data/Application/2E3CC4FC-1C0F-400B-8CC8-DE53E00B0B7C/Library/Caches/Camera/740DA991-7359-4CF8-B9F4-9BAB69B824AC.jpg'
var body = FetchBlob.wrap(path);
FetchBlob.fetch('POST', url, mime, body);

This will upload a zero byte file to server. To fix it, I have to remove the file:// prefix from path first.

Most helpful comment

What is the reason for FetchBlob.wrap not catering for that?

All 5 comments

They mentioned in Caveats
When passing a file path to the library, remove file:// prefix.

What is the reason for FetchBlob.wrap not catering for that?

+1

it might be related to what is told in the readme

When passing a file path to the library, remove file:// prefix.

What is the reason for FetchBlob.wrap not catering for that?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hellokunji picture hellokunji  路  3Comments

ditkachuk picture ditkachuk  路  4Comments

minh-dai picture minh-dai  路  3Comments

n1777 picture n1777  路  3Comments

MJXin picture MJXin  路  5Comments