# blockfetcher

> Fetching and saving blo.cks.org

Latest version **1.0.3** (published 2019-03-26) · ISC license · 0 weekly downloads

## Install

```sh
npm install blockfetcher
pnpm add blockfetcher
yarn add blockfetcher
bun add blockfetcher
```

Provides the command `blockfetcher`.

## 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.0.3 |
| Published | 2019-03-26 |
| First published | 2019-03-12 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 5.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Clément Renaud |
| Maintainers | clemsos |

## Links

- npm: https://www.npmjs.com/package/blockfetcher
- npm.io page: https://npm.io/package/blockfetcher

## Dependencies (3)

- [mkdirp](https://npm.io/package/mkdirp.md) ^0.5.1
- [slugify](https://npm.io/package/slugify.md) ^1.3.4
- [node-fetch](https://npm.io/package/node-fetch.md) ^2.3.0

## Recent versions

- 1.0.3 (latest) — 2019-03-26
- 1.0.2 — 2019-03-12
- 1.0.1 — 2019-03-12
- 1.0.0 — 2019-03-12

## README

# Block Fetcher

Fetch blocks from gist and save the files

```js
const blockfetcher = require("blockfetcher")

const gistId="https://bl.ocks.org/clemsos/009f78d9bf410295f63335419aead372".replace('https://bl.ocks.org/','')

blockfetcher.saveProject(gistId, "/tmp", "super-computers")
  .then(files => console.log(`${files.length} saved!`) )
  .catch(err =>  console.log(err.message))
```

### Usage

```js
saveProject(gistId, dest, folderName)
```

- `gistId` : the id from blocks or gist in the form `userId/hash`
- `dest` : destination folder (default: will save by in `./blocks`)
- `folderName` : the name of the folder where project files will be stored (default: will make a slug from the `gistId`)

Returns a js [Promise](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise).

### CLI

A command-line tool is also available.

```sh
./node_modules/bin/blockfetcher https://bl.ocks.org/clemsos/009f78d9bf410295f63335419aead372 -d /tmp -n lala
```

Help command

```sh

$ blocksfetcher -h

Usage: blocksfetcher [url] [options]

  url                 bl.ocks.org URL (required)
  --dest,-d           Destination folder (default: ./blocks)
  --name,-n           Name of the folder (default: gist hash)
  --version,-v        Print out the installed version
  --help              Show this help
```

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