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

balena-device-init

v7.0.1

Published

Configure and initialize devices using device specs

Downloads

4,112

Readme

balena-device-init

npm version dependencies Build Status

Configure and initialize devices using device specs.

Role

The intention of this module is to provide low level access to how balena configures and initialises devices using device specs.

THIS MODULE IS LOW LEVEL AND IS NOT MEANT TO BE USED BY END USERS DIRECTLY.

Installation

Install balena-device-init by running:

$ npm install --save balena-device-init

Documentation

init.configure(image, manifest, config, [options]) ⇒ Promise.<EventEmitter>

This function injects config.json and network settings into the image.

Kind: static method of init
Summary: Configure an image with an application
Returns: Promise.<EventEmitter> - configuration event emitter
Access: public

| Param | Type | Description | | --- | --- | --- | | image | String | path to image | | manifest | Object | device type manifest | | config | Object | a fully populated config object | | [options] | Object | configuration options |

Example

init.configure('my/rpi.img', manifest, config).then (configuration) ->

	configuration.on('stdout', process.stdout.write)
	configuration.on('stderr', process.stderr.write)

	configuration.on 'state', (state) ->
		console.log(state.operation.command)
		console.log(state.percentage)

	configuration.on 'error', (error) ->
		throw error

	configuration.on 'end', ->
		console.log('Configuration finished')

init.initialize(image, manifest, options) ⇒ Promise.<EventEmitter>

Kind: static method of init
Summary: Initialize an image
Returns: Promise.<EventEmitter> - initialization event emitter
Access: public

| Param | Type | Description | | --- | --- | --- | | image | String | path to image | | manifest | Object | device type manifest | | options | Object | configuration options |

Example

init.initialize('my/rpi.img', manifest, network: 'ethernet').then (configuration) ->

	configuration.on('stdout', process.stdout.write)
	configuration.on('stderr', process.stderr.write)

	configuration.on 'state', (state) ->
		console.log(state.operation.command)
		console.log(state.percentage)

	configuration.on 'burn', (state) ->
		console.log(state)

	configuration.on 'error', (error) ->
		throw error

	configuration.on 'end', ->
		console.log('Configuration finished')

Support

If you're having any problem, please raise an issue on GitHub and the balena team will be happy to help.

Tests

Create an .env file and put the following lines in it, replacing the asterisks with the valid credentials for a test user on balena-staging.com

TEST_EMAIL=***
TEST_PASSWORD=***

Run the test suite by doing:

$ npm test

Contribute

Before submitting a PR, please make sure that you include tests, and that coffeelint runs without any warning:

$ gulp lint

You can then run the tests with:

npm test

License

The project is licensed under the Apache 2.0 license.