fileUtils.ts (cafdf1d54eb57ce065306f704480cb72e6788d44) | fileUtils.ts (29fe487b627e2da4ad8fab93e4aa0e8c38506f62) |
---|---|
1import pathConst from '@/constants/pathConst'; 2import FastImage from 'react-native-fast-image'; 3import { 4 copyFile, 5 downloadFile, 6 exists, 7 mkdir, 8 PicturesDirectoryPath, --- 98 unchanged lines hidden (view full) --- 107} 108 109export function addFileScheme(fileName: string) { 110 if (fileName.startsWith('/')) { 111 return `file://${fileName}`; 112 } 113 return fileName; 114} | 1import pathConst from '@/constants/pathConst'; 2import FastImage from 'react-native-fast-image'; 3import { 4 copyFile, 5 downloadFile, 6 exists, 7 mkdir, 8 PicturesDirectoryPath, --- 98 unchanged lines hidden (view full) --- 107} 108 109export function addFileScheme(fileName: string) { 110 if (fileName.startsWith('/')) { 111 return `file://${fileName}`; 112 } 113 return fileName; 114} |
115 116export function addRandomHash(url: string) { 117 if (url.indexOf('#') === -1) { 118 return `${url}#${Date.now()}`; 119 } 120 return url; 121} 122 123export function trimHash(url: string) { 124 const index = url.lastIndexOf('#'); 125 if (index === -1) { 126 return url; 127 } 128 return url.substring(0, index); 129} |
|