FIleSystem.copyAsync not copying full video to cacheDirectory on IOS
See original GitHub issue🐛 Bug Report
Summary of Issue
Using FileSystem.copyAsync to copy videos on IOS from assets-library:// to file:// uri for uploading, videos are not copied successfully. FileSystem.getInfoAsync on the new file returns wrong file size and videos fail to upload as they appear corrupted.
Environment
Expo CLI 3.27.7 environment info: System: OS: macOS 10.15.7 Shell: 5.7.1 - /bin/zsh Binaries: Node: 12.13.1 - ~/.nvm/versions/node/v12.13.1/bin/node Yarn: 1.22.5 - /usr/local/bin/yarn npm: 6.12.1 - ~/.nvm/versions/node/v12.13.1/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2 IDEs: Xcode: 11.4.1/11E503a - /usr/bin/xcodebuild npmPackages: @expo/webpack-config: ^0.12.16 => 0.12.29 expo: ^38.0.0 => 38.0.10 react: 16.11.0 => 16.11.0 react-dom: 16.11.0 => 16.11.0 react-native: https://github.com/expo/react-native/archive/sdk-38.0.0.tar.gz => 0.62.2 react-native-web: ~0.11.7 => 0.11.7 react-navigation: ^4.3.9 => 4.4.0 Expo Workflow: managed
Steps to Reproduce
const newFileUri = FileSystem.cacheDirectory + file.filename // video.mov
FileSystem.copyAsync({
from: file.uri,
to: newFileUri,
}).then(() => {
FileSystem.getInfoAsync(newFileUri, { size: true }).then(
(asset) => {
if (asset.exists) {
console.log('file saved from asset. . . : ', asset)
}
})
Expected Behavior vs Actual Behavior
Video is 30mb+ and resulting asset is only 300kb give or take. Expect resulting asset from the copy to be full video/size, and to be able to be uploaded, not corrupt.
Thanks!
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:8 (1 by maintainers)
There’s a workaround you can try, note that I’ve only tested on iOS with Expo 40.0, expo-file-system 9.3.0, and expo-media-library 10.0.0.
This issue has been automatically closed since there has not been any recent activity after it was marked as stale. Please open a new issue for any related bugs.