
Security News
Risky Biz Podcast: Making Reachability Analysis Work in Real-World Codebases
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
cordova-background-upload
Advanced tools
This plugin provides a file upload functionality via javascript without necessarily using the browser platform of cordova. On the web it will use SuperAgent to post the files. Since it is done via Ajax, make sure your server supports CORS (cross origin requests).
The following browsers are supported:
Note: Background uploads are not supported on the web
When in a mobile environment, it will rely on the cordova-plugin-background-upload to allow for background uploads. If the plugin is not installed,it will fallback to superagent upload.
Installation
npm install --save cordova-background-upload
For mobile uploads:
cordova plugin add cordova-plugin-file --save
cordova plugin add cordova-plugin-background-upload --save
For android, you need to add the permission library also:
cordova plugin add cordova-plugin-android-permissions --save
Sample usage
import { BackgroundUpload } from 'cordova-background-upload';
var uploader = new BackgroundUpload().init();
uploader.on('success', function(upload) {
console.log("upload: " + upload.id + " has been completed successfully");
console.log(upload.serverResponse);
});
uploader.on('progress', function(upload) {
console.log("uploading: " + upload.id + " progress: " + upload.progress + "%");
});
uploader.on('error', function(uploadException) {
if (uploadException.id) {
console.log("upload: " + uploadException.id + " has failed");
} else {
console.error("uploader caught an error: " + uploadException.error);
}
});
Adding an upload is done via the upload
method. In case the plugin was not able to enqueue the upload, an exception will be thrown in the error event listener.
var payload = {
"id": "sd4ed",
"file": fileObject, //the file object obtained from an input type='file'
"serverUrl": "http://requestb.in/14cizzj1",
"headers": {
"api_key": "asdasdwere123sad"
},
"parameters": {
"signature": "mysign",
"timestamp": 112321321
}
};
uploader.upload(options);
Configuration
cordova-background-upload is brought to you by Spoon Consulting.
FAQs
Js library to upload files on web and via cordova on mobile
We found that cordova-background-upload demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.