npm.io
0.2.2 • Published 5 years ago

big-little-file

Licence
Apache-2.0
Version
0.2.2
Deps
1
Size
61 kB
Vulns
25
Weekly
0

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);
});

Keywords