Apache Cordova Fetch Library

Clone this repo:
  1. 12ee14a chore(deps): bump cross-spawn from 7.0.3 to 7.0.6 (#122) by dependabot[bot] · 14 days ago master
  2. 3ed8ff2 chore(ci): Add licence checker workflow (#123) by Darryl Pogue · 14 days ago
  3. 3b15497 chore(ci): Fix dependabot code scanning errors (#121) by Darryl Pogue · 6 weeks ago
  4. 1a9703e chore(deps): bump micromatch from 4.0.5 to 4.0.8 (#120) by dependabot[bot] · 6 weeks ago
  5. 3cb6c81 chore(deps): bump braces from 3.0.2 to 3.0.3 (#119) by dependabot[bot] · 6 months ago

cordova-fetch

NPM

Node CI

This package can be used to install and uninstall Node.js packages using npm.

Usage

fetch

Installs a module from:

  • npm registry
  • git url
  • tarball
    • url
    • file on local file system
  • folder path on local system

Returns a Promise resolving to the absolute path of the installed package.

const fetch = require('cordova-fetch');

fetch(spec, dest, opts).then(pathToInstalledPackage => {
    // Do something
});

Fetch Parameters

ParameterDescription
specA spec for the package to be installed (anything supported by npm install)
destLocation where to install the package
optsAdditional options (optional)
Fetch Options
OptionDefaultDescription
savefalseAdds the package as dependency to package.json iff true

uninstall

Uninstalls a package from the given directory. Returns a Promise that resolves when removal has finished.

const { uninstall } = require('cordova-fetch');

uninstall(packageName, dest, opts).then(() => {
    // Do something
});

Uninstall Parameters

ParameterDescription
packageNameName of the package to be uninstalled
destLocation from where to uninstall the package
optsAn Object with additional options
Uninstall Options
OptionDefaultDescription
savefalseRemoves dependency from package.json iff true