ipfs-add-folder 1.0.8 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ipfs-add-folder",
3
- "version": "1.0.8",
3
+ "version": "1.0.11",
4
4
  "description": "Recursively adds a folder to IPFS.",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -26,10 +26,9 @@
26
26
  },
27
27
  "homepage": "https://github.com/Cladular/ipfs-add-folder#readme",
28
28
  "dependencies": {
29
- "chalk": "^3.0.0",
30
- "commander": "^4.1.1",
31
- "ipfs-http-client": "^48.1.0",
32
- "npm": "^7.0.9"
29
+ "chalk": "^4.1.2",
30
+ "commander": "^8.2.0",
31
+ "ipfs-http-client": "^52.0.3"
33
32
  },
34
33
  "publishConfig": {
35
34
  "access": "public"
@@ -17,13 +17,17 @@ const program = new commander.Command(packageJson.name)
17
17
  })
18
18
  .option('-p, --pin', 'pin uploaded folders and files')
19
19
  .option('-q, --quiet', 'Will only print the result hash of the root folder once complete')
20
+
21
+ program
20
22
  .parse(process.argv);
21
23
 
24
+ const opts = program.opts();
25
+
22
26
  addFolder(
23
27
  folderPath,
24
28
  nodeUrl,
25
- program.pin,
26
- program.quiet);
29
+ opts.pin,
30
+ opts.quiet);
27
31
 
28
32
  function addFolder(
29
33
  folderPath,
@@ -32,12 +36,12 @@ function addFolder(
32
36
  quiet
33
37
  ) {
34
38
  files = getAllFiles(folderPath);
35
- ipfs = ipfsClient(nodeUrl);
39
+ ipfs = ipfsClient.create({ url: nodeUrl });
36
40
  rootFolder = `/${path.relative(path.resolve(process.argv[2], ".."), process.argv[2])}`;
37
41
 
38
42
  ipfs.add(files, (pin ? { pin: true } : {}))
39
43
  .then(result => {
40
- rootItem = `/ipfs/${result[result.length - 1].hash}`;
44
+ rootItem = `/ipfs/${result.cid.toString()}`;
41
45
  if (!quiet) {
42
46
  console.info(result)
43
47
  console.info('')
@@ -47,7 +51,7 @@ function addFolder(
47
51
  ipfs.files.cp(rootItem, rootFolder);
48
52
 
49
53
  if (quiet) {
50
- console.info(result[result.length - 1].hash);
54
+ console.info(result.cid.toString());
51
55
  }
52
56
  })
53
57
  .catch(error => {