To send the body as-is, simply use a Content-Type header not containing BASE64 or application/octet.Otherwise, if a string starts with RNFetchBlob-file:// (which can simply be done by RNFetchBlob.wrap(PATH_TO_THE_FILE)), it will try to find the data from the URI string after RNFetchBlob-file:// and use it as the request body.If the Content-Type containing substring BASE64 or application/octet the given body will be considered as a BASE64 encoded data which will be decoded to binary data as the request body.To send binary data, you have two choices, use BASE64 encoded string or path points to a file contains the body.When the body is an Array we will set proper content type for you. To send a form data, the Content-Type header does not matter.The rule is described in the following diagram Var RNFetchBlob = require('react-native-fetch-blob').defaultĪfter 0.8.0 react-native-fetch-blob automatically decides how to send the body by checking its type and Content-Type in the header. In 0.8.0 we introduced experimental Web API polyfills that make it possible to use browser-based libraries in React Native, such as, FireBase JS SDK Installation The file system supports file stream, so you don't have to worry about OOM problem when accessing large files. For example, developers can upload and download data directly from/to storage, which is more efficient, especially for large files. We've implemented highly customizable filesystem and network module which plays well together. It is committed to making file access and transfer easier and more efficient for React Native developers. This project was started in the cause of solving issue facebook/react-native#854, React Native's lacks of Blob implementation which results into problems when transferring binary data. Android Media Scanner, and Download Manager Support.JSON stream supported base on Oboe.js (visit Wiki to get the complete documentation).Blob, File, XMLHttpRequest polyfills that make browser-based library available in RN (experimental).File stream support for dealing with large file.Native-to-native file manipulation API, reduce JS bridging performance loss. File API supports regular files, Asset files, and CameraRoll files.Transfer data directly from/to storage without BASE64 bridging.That means issues and PRs should be posted there.Ī project committed to making file access and data transfer easier and more efficient for React Native developers.įor Firebase Storage solution, please upgrade to the latest version for the best compatibility. The owners of this fork have agreed to maintain this package: This repository no longer is the main location of "react-native-fetch-blob".
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |