This package has been deprecated

Author message:

resin-config-inject is deprecated, please use balena-image-fs instead

resin-config-inject

3.0.0 • Public • Published

resin-config-inject

npm version dependencies Build Status

Resin.io config.json injection.

Installation

Install resin-config-inject by running:

$ npm install --save resin-config-inject

Documentation

inject.write(String image, Object config, Partition partition, Function callback)

Write a config object to an image.

See the Partition Definition section for more information about the partition parameter.

The callback gets passed one argument: (error).

Example:

inject.write 'path/to/rpi.img'hello: 'world'3(error) ->
    throw error if error?

inject.read(String image, Partition partition, Function callback)

Read a config object from an image.

See the Partition Definition section for more information about the partition parameter.

The callback gets passed two arguments: (error, config).

Example:

inject.read 'path/to/rpi.img''4:1'(error, config) ->
    throw error if error?
    console.log(config)

inject.writePartition(String image, Object config, Partition partition, Function callback)

Write a config object to a partition, and return a ReadableStream of the partition.

The callback gets passed two arguments: (error, stream).

The partition is extracted into a temporary file. Once the returned stream emits the close event, the temporary file is removed.

Example:

inject.writePartition 'path/to/rpi.img'hello: 'world''4:1'(error, stream) ->
    throw error if error?
    stream.pipe(anotherStream)

Partition Definition

A partition definition is a number or string representing the primary partition number, or an extended partition number along with a logical partition number.

Notice that this definition is device dependent. Refer to specific device bundles for this information.

Examples:

  • 4 is the primary partition number four.
  • 3:1 is the first logical partition of the third primary extended partition.

Tests

Run the test suite by doing:

$ gulp test

Contribute

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

$ gulp lint

Support

If you're having any problem, please raise an issue on GitHub.

ChangeLog

v3.0.0

  • Perform injection in a FAT partition instead of serialising the JSON directly.

v2.0.0

  • Handle partition definition instead of byte offsets in the public interface.

v1.0.1

  • Fix incompatibility issues with Node v0.11.

License

The project is licensed under the MIT license.

Readme

Keywords

Package Sidebar

Install

npm i resin-config-inject

Weekly Downloads

4

Version

3.0.0

License

MIT

Last publish

Collaborators

  • balena.io