react-native-fetch-blob
Version:
A module provides upload, download, and files access API. Supports file stream read/write for process large files.
29 lines (23 loc) • 669 B
JavaScript
export default {
isFileURI : (uri:string):boolean => {
if(typeof uri !== 'string')
return false
return /^RNFetchBlob-file\:\/\//.test(uri)
},
isJSONStreamURI : (uri:string):boolean => {
if(typeof uri !== 'string')
return false
return /^JSONStream\:\/\//.test(uri)
},
removeURIScheme : (uri:string, iterations:number):string => {
iterations = iterations || 1
let result = uri
for(let i=0;i<iterations;i++) {
result = String(result).replace(/^[^\:]+\:\/\//, '')
}
return String(result)
},
unwrapFileURI : (uri:string):string => {
return String(uri).replace(/^RNFetchBlob-file\:\/\//, '')
}
}