This repository has been archived by the owner on May 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add .path and .path.silent functions to detect binary (#40)
After installation if you wish to specify a path to the installed binary, it's useful for this module to be able to tell the world where it put the binary, so this PR adds `.path` and `.path.silent()` functions to do that. This way we can use the installed module without having to rely on any external context or platform. fixes #25
- Loading branch information
1 parent
7465f17
commit c48958d
Showing
4 changed files
with
96 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,22 @@ This module downloads `go-ipfs` binaries from https://dist.ipfs.io into your pro | |
|
||
By default it will download the go-ipfs version that matches the npm version of this module. So depending on `[email protected]` will install `go-ipfs v0.4.19` for your current system architecture, in to your project at `node_modules/go-ipfs-dep/go-ipfs/ipfs`. | ||
|
||
After downloading you can find out the path of the installed binary by calling the `path` function exported by this module: | ||
|
||
```javascript | ||
const { path } = require('go-ipfs-dep') | ||
|
||
console.info('go-ipfs is installed at', path()) | ||
``` | ||
|
||
An error will be thrown if the path to the binary cannot be resolved - if you do not wish this to happen, call `path.silent()`: | ||
|
||
```javascript | ||
const { path: silent } = require('go-ipfs-dep') | ||
|
||
console.info('go-ipfs may installed at', silent()) | ||
``` | ||
|
||
### Overriding the go-ipfs version | ||
|
||
You can override the version of go-ipfs that gets downloaded by adding by adding a `go-ipfs.version` field to your `package.json` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters