
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
cordova-plugin-document-contract
Advanced tools
Cordova plugin to interact with an Android Document Provider.
Android document / media provider plugin for Cordova
Install through the Cordova plugin repository:
cordova plugin add cordova-plugin-document-contract
Install directly from github:
cordova plugin add https://github.com/danjarvis/cordova-plugin-document-contract.git
The plugin exposes two functions for working with a document/media provider.
getContract({
uri: 'content://com.foo.bar/xyz', // content URI (required)
columns: ['_display_name'] // projection of columns (optional)
},
success, // success callback
error); // error callback
Resolves a content URI and retrieves a contract object.
An object of key/value pairs will get passed to the success
callback (keys will becolumns
that returned a value).
If columns
is not specified, the query will return all available columns. This is not recommended as it is inefficient.
Documentation for columns of interest:
createFile({
uri: 'content://com.foo.bar/xyz' // content URI (required)
fileName: 'file.pdf' // name of output file (required)
},
success, // success callback
error); // error callback
Resolves a content URI, retrieves corresponding file data and writes it to a file in the application's data directory (cordova.file.dataDirectory).
For the below examples, assume that
contentUri
is valid Content URI (e.g. coming from a Google Drive Send Intent).Get a full contract:
window.plugins.DocumentContract.getContract({
uri: contentUri
},
function(contract) {
console.dir(contract);
// Outputs
// {
// '_display_name': 'SampleFile.pdf',
// 'document_id': 'foo123',
// 'last_modified': '/SomeDate/',
// 'mime_type': 'application/pdf',
// 'nth key': 'nth value'
// }
},
function(error) {
console.log('Error getting contract: ' + error);
}
);
Get a specific contract:
window.plugins.DocumentContract.getContract({
uri: contentUri,
columns: [
'_display_name', 'mime_type', '_size'
]
},
function(contract) {
console.dir(contract);
// Outputs
// {
// '_display_name': 'SampleFile.pdf',
// '_size': '5242880',
// 'mime_type': 'application/pdf'
// }
},
function(error) {
console.log('Error getting contract: ' + error);
}
);
Get file name and create file:
window.plugins.DocumentContract.getContract({
uri: contentUri,
columns: [
'_display_name'
]
},
function(contract) {
window.plugins.DocumentContract.createFile({
uri: contentUri,
fileName: contract['_display_name'] || 'unknown'
},
function(fileName) {
resolveLocalFileSystemURL(
cordova.file.dataDirectory + fileName,
function(fileEntry) {
// Do something with FileEntry
},
function(error) {
console.log('Error resolving file: ' + error);
}
);
},
function(error) {
console.log('Error creating file: ' + error);
}
);
},
function(error) {
console.log('Error getting contract: ' + error);
}
);
© Dan Jarvis 2015, MIT
FAQs
Cordova plugin to interact with an Android Document Provider.
The npm package cordova-plugin-document-contract receives a total of 18 weekly downloads. As such, cordova-plugin-document-contract popularity was classified as not popular.
We found that cordova-plugin-document-contract demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.