tree: 34eb4e23f24ccdd2e04ad721f7e0f82dc7744453 [path history] [tgz]
  1. .github/
  2. spec/
  3. .asf.yaml
  4. .eslintrc.yml
  5. .gitignore
  6. .npmignore
  7. .ratignore
  8. CONTRIBUTING.md
  9. index.js
  10. LICENSE
  11. NOTICE
  12. package-lock.json
  13. package.json
  14. README.md
  15. RELEASENOTES.md
README.md

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