I am trying to upload a file in a monorepo which in typescript. My expectations are if I have File object, it should upload file to a particular destination. I used @rpldy/uploady package for web and react-native-document-picker package for mobile to capture file object. As per my understanding @rpldy/uploader package can help me to upload corresponding file. I can use simple multiple part upload but this package provides me functionality to cancel, monitor progress of upload and many things in a simpler way.
I tried to imitate the implementation in my react-native package but its not working.
const uploader = createUploader({ destination: { url: 'https://my-server.com/upload' }, autoUpload: false });
uploader.add([file], { autoUpload: false });
uploader.on(UPLOADER_EVENTS.BATCH_ADD, (batch) => {
console.log(`NEW BATCH ADDED WITH ${batch.items.length} FILES`, batch);
});
uploader.on(UPLOADER_EVENTS.BATCH_START, (batch) => {
console.log(`NEW BATCH STARTED WITH ${batch.items.length} FILES`, batch);
});
uploader.on(UPLOADER_EVENTS.BATCH_FINISH, (batch) => {
console.log(`NEW BATCH FINISH WITH ${batch.items.length} FILES`, batch);
});
uploader.upload();
In console only UPLOADER_EVENTS.BATCH_ADD is getting logged out. No other events are coming. I tried to shuffle destination and auto-upload as false in all 3 three place of createUploader, add function and upload function Can anyone please let me know what I am doing wrong.