# component-downloader

> download components from a remote

Latest version **1.2.0** (published 2015-03-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install component-downloader
pnpm add component-downloader
yarn add component-downloader
bun add component-downloader
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2015-03-14 |
| First published | 2014-02-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 13 |
| Known vulnerabilities | 0 (+6 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 11 |
| Author | Jonathan Ong |
| Maintainers | jongleberry, tootallnate, tjholowaychuk, juliangruber, yields, ianstormtaylor, timoxley, mattmueller, jonathanong, queckezz, netpoetica, anthonyshort, nami-doc, dominicbarnes, clintwood, thehydroimpulse, stephenmathieson, trevorgerhardt, timaschew, jasonkuhrt |

## Links

- npm: https://www.npmjs.com/package/component-downloader
- Repository: https://github.com/component/downloader.js
- Issues: https://github.com/component/downloader.js/issues
- npm.io page: https://npm.io/package/component-downloader

## Dependencies (13)

- [co](https://npm.io/package/co.md) ^3
- [debug](https://npm.io/package/debug.md) *
- [chanel](https://npm.io/package/chanel.md) ^2.0.1
- [mkdirp](https://npm.io/package/mkdirp.md) ~0.3.5
- [rimraf](https://npm.io/package/rimraf.md) ^2.2.6
- [semver](https://npm.io/package/semver.md) ^2.2.0
- [unglob](https://npm.io/package/unglob.md) ~0.1.2
- [write-to](https://npm.io/package/write-to.md) ^1.0.0
- [decompress](https://npm.io/package/decompress.md) ~0.2.0
- [graceful-fs](https://npm.io/package/graceful-fs.md) ^2.0.2
- [component-remotes](https://npm.io/package/component-remotes.md) ^1.1.1
- [component-consoler](https://npm.io/package/component-consoler.md) ^2.0.0
- [generator-supported](https://npm.io/package/generator-supported.md) ~0.0.1

## Recent versions

- 1.2.0 (latest) — 2015-03-14
- 1.1.9 — 2015-03-14
- 1.1.7 — 2014-11-23
- 1.1.6 — 2014-10-05
- 1.1.4 — 2014-09-26
- 1.1.3 — 2014-06-11
- 1.1.2 — 2014-06-11
- 1.1.1 — 2014-04-07
- 1.1.0 — 2014-04-06
- 1.0.2 — 2014-04-03
- 1.0.1 — 2014-04-02
- 1.0.0 — 2014-04-01
- 0.0.2 — 2014-03-23
- 0.0.1 — 2014-02-23
- 0.0.0 — 2014-02-22

## README

# Component Downloader [![Build Status](https://travis-ci.org/componentjs/downloader.js.svg?branch=master)](https://travis-ci.org/componentjs/downloader.js)

Downloads components based on [remotes](https://github.com/component/remotes.js).

- Either download a component based on specific fields, or just download the entire repository
- Unglobs all the fields of the `component.json`
- Normalizes the `component.json`
- Deletes corrupted installations

```js
var Downloader = require('component-downloader');
var downloader = Downloader({
  concurrency: 5, // 5 files at a time
  verbose: true,
});

co(function* () {
  yield* download('component/emitter', '1.0.0');
  // will be installed to components/component/emitter/1.0.0
})
```

If you don't want to use generators:

```js
var download = co(download);
download('component/emitter', '1.0.0', function (err) {
  if (err) throw err;
  console.log('downloaded!');
})
```

## API

### var download = downloader([options])

The `options` are:

- `dir` <`components`> - folder to download components to.
- `remotes` - remotes to download from. Defaults to only `github`.
- `fields` - `fields` to download and unglob. Defaults to those specificed in the specifications.
- `concurrency` <1> - number of concurrent file downloads.
- `verbose` <false> - log when installs start and finish.
- `archive` <archive> - download the entire repository instead of just the files specified in the `fields`.
- `maxFiles` <10> - maximum number of files to download before just downloading the entire repository.

### yield* download([remotes], repo, ref, [archive])

- `remotes` - array of remote names to download from
- `repo`
- `ref`
- `archive` - download the entire repository

## License

The MIT License (MIT)

Copyright (c) 2014 Jonathan Ong me@jongleberry.com

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

---
_Source: https://npm.io/package/component-downloader · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
