Apache Cordova Fetch Library

Clone this repo:
  1. 69a5856 chore(ci): Set up CodeQL analysis (#118) by Darryl Pogue · 2 weeks ago master
  2. 63476a4 chore(deps): Update some dependencies, add Node 20 to CI (#116) by Darryl Pogue · 3 weeks ago
  3. 4d5820d ci: update codecov@v4 w/ token (#117) by エリス · 3 weeks ago
  4. 12de62f chore: increment package version to 4.0.1-dev by Erisu · 1 year, 1 month ago
  5. f1f9ff3 release(4.0.0): updated release notes & version (fetch-4.0.0) by Erisu · 1 year, 1 month ago 4.0.x 4.0.0 rel/4.0.0

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