Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 1b98151

Browse files
committed
feat: update CLI to use latest Files API
1 parent 5c75ff5 commit 1b98151

File tree

4 files changed

+8
-19
lines changed

4 files changed

+8
-19
lines changed

src/cli/bin.js

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -69,20 +69,9 @@ if (args[0] === 'daemon' || args[0] === 'init') {
6969
throw err
7070
}
7171

72-
// add mfs commands
72+
// add MFS (Files API) commands
7373
mfs(cli)
7474

75-
// NOTE: This creates an alias of
76-
// `jsipfs files {add, get, cat}` to `jsipfs {add, get, cat}`.
77-
// This will stay until https://github.com/ipfs/specs/issues/98 is resolved.
78-
const addCmd = require('./commands/files/add')
79-
const catCmd = require('./commands/files/cat')
80-
const getCmd = require('./commands/files/get')
81-
const aliases = [addCmd, catCmd, getCmd]
82-
aliases.forEach((alias) => {
83-
cli.command(alias)
84-
})
85-
8675
cli
8776
.commandDir('commands')
8877
.help()
@@ -113,7 +102,7 @@ if (args[0] === 'daemon' || args[0] === 'init') {
113102
exitCode = 1
114103
})
115104
.then(() => cleanup())
116-
.catch(() => {})
105+
.catch((e) => {})
117106
.then(() => {
118107
if (exitCode !== 0) {
119108
process.exit(exitCode)

src/cli/commands/files/add.js renamed to src/cli/commands/add.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ const getFolderSize = require('get-folder-size')
1111
const byteman = require('byteman')
1212
const waterfall = require('async/waterfall')
1313
const mh = require('multihashes')
14-
const utils = require('../../utils')
15-
const print = require('../../utils').print
16-
const createProgressBar = require('../../utils').createProgressBar
14+
const utils = require('../utils')
15+
const print = require('../utils').print
16+
const createProgressBar = require('../utils').createProgressBar
1717

1818
function checkPath (inPath, recursive) {
1919
// This function is to check for the following possible inputs

src/cli/commands/files/cat.js renamed to src/cli/commands/cat.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ module.exports = {
2929
length: argv.length
3030
}
3131

32-
const stream = argv.ipfs.files.catReadableStream(path, options)
32+
const stream = argv.ipfs.catReadableStream(path, options)
3333

3434
stream.once('error', (err) => {
3535
throw err

src/cli/commands/files/get.js renamed to src/cli/commands/get.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const path = require('path')
55
const mkdirp = require('mkdirp')
66
const pull = require('pull-stream')
77
const toPull = require('stream-to-pull-stream')
8-
const print = require('../../utils').print
8+
const print = require('../utils').print
99

1010
function checkArgs (hash, outPath) {
1111
// format the output directory
@@ -63,7 +63,7 @@ module.exports = {
6363

6464
const dir = checkArgs(ipfsPath, argv.output)
6565

66-
const stream = argv.ipfs.files.getReadableStream(ipfsPath)
66+
const stream = argv.ipfs.getReadableStream(ipfsPath)
6767

6868
stream.once('error', (err) => {
6969
if (err) { throw err }

0 commit comments

Comments
 (0)