npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@carnesen/bitcoind

v0.0.0-0

Published

A Node.js library for managing the bitcoin server process `bitcoind`

Downloads

3

Readme

@carnesen/bitcoind Build Status

A Node.js library for managing the bitcoin server process bitcoind

Install

$ npm install @carnesen/bitcoind

The package includes runtime JavaScript files suitable for Node.js >=8 as well as the corresponding TypeScript type declarations.

Usage

Here is a little TypeScript Node.js script that spawns bitcoind:

// example.ts
import { spawn } from '@carnesen/bitcoind';
const bitcoinHome = '/usr/local/bitcoin-0.17.1';
(async () => {
  try {
    await spawn({ bitcoinHome });
    process.exit(0);
  } catch (ex) {
    console.log(ex);
    process.exit(1);
  }
})()

Running this script looks like:

$ ts-node example.ts
2019-01-24T03:57:07Z Bitcoin Core version v0.17.1 (release build)
2019-01-24T03:57:07Z InitParameterInteraction: parameter interaction: -whitelistforcerelay=1 -> setting -whitelistrelay=1
2019-01-24T03:57:07Z Validating signatures for all blocks.
...

The bitcoind child process inherits the Node.js parent's stdout, stdin, and stderr. So in non-daemon mode when bitcoind logs to the terminal, so does the parent.

API

spawn({bitcoinHome, configFilePath}): Promise<void>

Reads a bitcoin configuration file and spawns bitcoind as a child process

bitcoinHome?

string. If not provided, bitcoind must be on your PATH. If provided, absolute path of a directory where the bitcoin server software is installed. By convention, bitcoind must be located at `${bitcoinHome}/bin/bitcoind`.

configFilePath?

string. Defaults to the platform-dependent location where the bitcoin server software looks for its configuration file, e.g. '~/.bitcoin/bitcoin.conf' on Linux. Before spawning bitcoind, spawnBitcoin reads the configuration file and modifies its behavior slightly based on what it finds. If the configuration does not specify daemon as true, the spawnBitcoin kills the child bitcoind process if the parent Node.js process exits. Also if daemon is not set to true (1), bitcoind exiting is always considered an error even if it exits with status code 0 (success).

Promise<void>

Represents the running bitcoind child. If there is an error spawning the child or if the child exits for any reason, the promise rejects. The only exception to that rule is if daemon is set to true and the child's exit status is 0 (success). In that case the promise resolves.

More information

This library has a number of unit tests with >95% coverage. Check out the tests directory for more examples of how it works. If you encounter any bugs or have any questions or feature requests, please don't hesitate to file an issue or submit a pull request on this project's repository on GitHub.

Related