Skip to content

dDrive CLI

Jared Rice Sr edited this page Jul 6, 2018 · 1 revision

The official command CLI for dDrive similiar to the official command CLI for dPack.

Installation

$ npm install @ddrive/cli@latest -g

Usage

Usage: ddrive: [-dD] [--help] [--version]
       ddrive: <command> [options] -- [pathspec]


Commands:
  init           Initialize a new vault
  info           Show public information about the vault
  stat           Stat a file or directory
  read           Read a range from a file (Requires public key)
  serve          Serve a dDrive over HTTP
  write          Write to a file (Requires secret key)
  unlink         Remove a file (Requires secret key)
  download       Download file or entire vault (Requires public key)

Aliases:
  init           i, initialize
  read           get, cat
  serve          http
  write          add, put, set
  unlink         rm, delete, del, remove
  upload         up
  readdir        list, ls, l
  download       down

Options:
  --help, -h     Show this message
  --version, -V  Output program version
  --key, -k      dDrive vault public key
  --debug, -D    Enable debug output (DEBUG=ddrive:cli*)
  --start, -S    Range start offset when using ranged streams
  --end, -E      Range end offset when using ranged streams
  --length, -L   Range length when using ranged streams
  --port, -p     Port to bind HTTP server to
  --ram, -M      Store in random access memory

API

$ ddrive init

Initialize a new vault

$ ddrive info

Show public information about the vault

$ ddrive stat

Stat a file or directory

$ ddrive read

Read a range from a file (Requires public key)

$ ddrive write

Write to a file (Requires secret key)

$ ddrive serve

Serve a ddrive over HTTP

$ ddrive unlink

Remove a file (Requires secret key)

$ ddrive download

Download file or entire vault (Requires public key)

Configuration

This module uses rc to allow things like @flockcore/core to be configured. dDrive options like the secret key for dDatabase can also be specified here. Create a .ddriverc file with your dDrive. See below for an example object.

{
  "drive": {
    "sparse": true,
    "secretKey": "..."
  },

  "revelation": {
    "live": true,
    "dns": {
      "server": ["revelation1.dwebs.io"],
      "domain": "dweb.local"
    },
  }
}