big-little-file
A Javascript utility for uploading both small and huge files.
See the example-app README and the example code, or follow these directions:
Add to your package.json
:
"big-little-file": "^0.2.0"
And then in your React component or action:
let bigLittle = await BigLittleFile.create(
'https://cdsdeva.catalyticds.com/yacht/api/data/files',
`Bearer ${this.state.jwt}`,
file,
{
name: file.name,
group: 'My Upload Test Files'
}
);
bigLittle.upload(progressData => {
console.log(progressData.uploadedBytes + " completed of " + progressData.totalBytes);
}).then(fileInfo => {
console.log("File fully uploaded to: " + fileInfo.path);
}).catch(err => {
console.log(err);
});