cordova-plugin-android-downloadmanager-ts

0.5.1-1 • Public • Published

cordova-plugin-android-downloadmanager-ts

Build Status

Plugin to expose Android's DownloadManager in Javascript

Usage

var downloadManager = require('cordova-plugin-android-downloadmanager-ts.DownloadManager')

API

Please refer to DownloadManager for parameter use.

downloadManager.enqueue(req, [cb])

cb(err, idString)

{
  uri: '',
  title: '',
  description: '',
  mimeType: '',

  visibleInDownloadsUi: true,
  notificationVisibility: 0,

  // Either of the next three properties
  destinationInExternalFilesDir: {
    dirType: '',
    subPath: ''
  },
  destinationInExternalPublicDir: {
    dirType: '',
    subPath: ''
  },
  destinationUri: '',
  headers: [{header: 'Authorization', value: 'Bearer iaksjfd89aklfdlkasdjf'}]
}

downloadManager.query([filter], cb)

You can query the SQLite database that backs DownloadManager, but the native Android query method only supports two filters:

{
  ids: ["1"],
  status: 0
}

This will invoke the callback of the signature cb(err, entryArray) with each entry being objects of the form:

{
  "id": String,
  "title": String,
  "description": String,
  "mediaType": String,
  "localFilename": String,
  "localUri": String,
  "mediaproviderUri": String,
  "uri": String,
  "lastModifiedTimestamp": Number,
  "status": Number,
  "reason": Number,
  "bytesDownloadedSoFar": Number,
  "totalSizeBytes": Number
}

downloadManager.remove(ids, [cb])

ids should be an array of string id's. cb(err, removedCount)

Install

npm install cordova-plugin-android-downloadmanager-ts

License

ISC

Readme

Keywords

Package Sidebar

Install

npm i cordova-plugin-android-downloadmanager-ts

Weekly Downloads

0

Version

0.5.1-1

License

ISC

Unpacked Size

16.5 kB

Total Files

8

Last publish

Collaborators

  • libinv