tus-js-client: Crashed to upload large files ( > 500MB): [Terminating app due to uncaught exception 'NSMallocException', reason: 'Failed to grow buffer']
Hi.
I’m trying to upload a large file. My application crashes after launching the upload with the error:
- Terminating app due to uncaught exception ‘NSMallocException’, reason: ‘Failed to grow buffer’
On a small file size works well.
iPad Pro Deployment Target : 12.1 React-Native v0.58
Code:
const upload = new tus.Upload({ uri:
`${RNFS.DocumentDirectoryPath}/images/${item.image}`}, {
endpoint: 'http://192.168.1.5:1080/files/',
retryDelays: [0, 1000, 3000, 5000, 10000, 15000, 20000],
resume: true,
metadata: {
name: item.image,
filetype: item.image.substring(item.image.lastIndexOf('.') + 1).toUpperCase(),
copyright: 30
},
onError: (error) => {
console.log('Error upload:', error)
},
onProgress: (uploadedBytes, totalBytes) => {
console.log(`Progress: ${uploadedBytes / totalBytes}%`)
},
onSuccess: () => {
console.log('Upload URL:', upload.url)
}
})
upload.start()
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 55 (19 by maintainers)
@nikolaytsigvintsev I managed to upload it to Vimeo with large files. Implementation:
sources:
i will try it with a compatible backend
if you want to use tus-js-client you need to have a tus compatible backend. the official recommended one is https://github.com/tus/tusd
did you try this code? https://github.com/tus/tus-js-client/issues/146#issuecomment-671967166
@samal-rasmussen Ah, thank you for the insights. So if I understand correctly, you are just using the FileReader that is built into tus-js-client? I.e. this one: https://github.com/tus/tus-js-client/blob/c0b5a7dec0f084db8e6c2e75eae25a19a2e364d3/lib/browser/fileReader.js#L9-L19