mirror of
https://github.com/balzack/databag.git
synced 2025-03-13 00:50:03 +00:00
renaming file as jpg
This commit is contained in:
parent
3e4233b8df
commit
b2d8332b7b
@ -79,7 +79,7 @@ export function useImageAsset(asset) {
|
|||||||
updateState({ downloaded: true });
|
updateState({ downloaded: true });
|
||||||
const epoch = Math.ceil(Date.now() / 1000);
|
const epoch = Math.ceil(Date.now() / 1000);
|
||||||
const dir = Platform.OS === 'ios' ? RNFS.DocumentDirectoryPath : RNFS.DownloadDirectoryPath;
|
const dir = Platform.OS === 'ios' ? RNFS.DocumentDirectoryPath : RNFS.DownloadDirectoryPath;
|
||||||
const path = `${dir}/databag_${epoch}.dat`
|
const path = `${dir}/databag_${epoch}`
|
||||||
if (state.url.substring(0, 7) === 'file://') {
|
if (state.url.substring(0, 7) === 'file://') {
|
||||||
await RNFS.copyFile(state.url.substring(7).split('?')[0], path);
|
await RNFS.copyFile(state.url.substring(7).split('?')[0], path);
|
||||||
}
|
}
|
||||||
@ -88,7 +88,8 @@ export function useImageAsset(asset) {
|
|||||||
}
|
}
|
||||||
const block = await RNFS.read(path, 8, 0, 'base64');
|
const block = await RNFS.read(path, 8, 0, 'base64');
|
||||||
if (block === '/9j/4AAQSkY=') {
|
if (block === '/9j/4AAQSkY=') {
|
||||||
await RNFS.scanFile(path);
|
await RNFS.moveFile(path, `${path}.jpg}`);
|
||||||
|
await RNFS.scanFile(`${path}.jpg}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user