# resin-device-operations

> Execute device spec operations

Latest version **4.0.1** (published 2026-02-19) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install resin-device-operations
pnpm add resin-device-operations
yarn add resin-device-operations
bun add resin-device-operations
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; no vulnerabilities; has provenance; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 4.0.1 |
| Published | 2026-02-19 |
| First published | 2015-07-29 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=20 |
| Dependencies | 5 |
| Unpacked size | 79.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 3 |
| Author | Balena Ltd. |
| Maintainers | balena.io |
| Keywords | resin, device, spec, commands, command, operations, operation |

## Links

- npm: https://www.npmjs.com/package/resin-device-operations
- Repository: https://github.com/balena-io-modules/resin-device-operations
- Issues: https://github.com/balena-io-modules/resin-device-operations/issues
- npm.io page: https://npm.io/package/resin-device-operations

## Dependencies (5)

- [tslib](https://npm.io/package/tslib.md) ^2.8.1
- [lodash](https://npm.io/package/lodash.md) ^4.17.15
- [rindle](https://npm.io/package/rindle.md) ^3.0.0
- [etcher-sdk](https://npm.io/package/etcher-sdk.md) ^10.0.0
- [balena-image-fs](https://npm.io/package/balena-image-fs.md) ^7.5.3

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 4.0.1 (latest) — 2026-02-19
- 4.0.1-build-add-npm-oidc-permissions-9a60e8a8cd5ee722ef712a5e4ac33a148b45e664-1 (build-add-npm-oidc-permissions) — 2026-02-18
- 4.0.0-build-convert-to-ts-22752b30b3321accfd648568558bf1f929583266-1 (build-convert-to-ts) — 2025-09-23
- 3.0.1-build-ts-tests-67dd3f274e638e3ee3885dfa25c0f4c9ec96b9e3-1 (build-ts-tests) — 2025-09-22
- 3.0.0-build-drop-node-18-d91de0613eec00aab75c64f317c5ab1752ae46bd-1 (build-drop-node-18) — 2025-06-06
- 2.0.0-build-drivelist-9e1f229866b49aa264f16ea014a7b7fb1b4b3635-1 (build-drivelist) — 2024-04-08
- 2.0.0-build-drivelist-14212699a1cc4b0d274f5aae55f9e0fa792b5767-1 (build-drivelist-14212699a1cc4b0d274f5aae55f9e0fa792b5767) — 2024-04-08
- 1.7.1-drivelist-bump-e8b7ce7a744a8b7cb5ce552ea288bb8a4c83638e (drivelist-bump-e8b7ce7a744a8b7cb5ce552ea288bb8a4c83638e) — 2021-03-12
- 1.7.1-drivelist-bump-1f39667ff162b81117fcf81fa6f789e8cea622f4 (drivelist-bump-1f39667ff162b81117fcf81fa6f789e8cea622f4) — 2021-03-12
- 4.0.0 — 2025-09-23
- 4.0.0-build-convert-to-ts-8f88021e0fe75fa0fe95df4c79942b24be178257-1 — 2025-09-23
- 3.0.1 — 2025-09-22
- 4.0.0-build-convert-to-ts-b0349f443132a0831aa61e958142eac2cce860e5-1 — 2025-09-22
- 4.0.0-build-convert-to-ts-d9d3495b8209036306b16425caac417bcaae5fb9-1 — 2025-09-22
- 4.0.0-build-convert-to-ts-cf20c9461880b72f404a1b82aae4ba43bf29416e-1 — 2025-09-22
- … 45 more at https://npm.io/package/resin-device-operations/versions

## README

resin-device-operations
-----------------------

[![npm version](https://badge.fury.io/js/resin-device-operations.svg)](http://badge.fury.io/js/resin-device-operations)
[![dependencies](https://david-dm.org/resin-io-modules/resin-device-operations.png)](https://david-dm.org/resin-io-modules/resin-device-operations.png)
[![Build Status](https://travis-ci.org/resin-io-modules/resin-device-operations.svg?branch=master)](https://travis-ci.org/resin-io-modules/resin-device-operations)
[![Build status](https://ci.appveyor.com/api/projects/status/vob1fmf59evt6tr5/branch/master?svg=true)](https://ci.appveyor.com/project/resin-io/resin-device-operations/branch/master)

Join our online chat at [![Gitter chat](https://badges.gitter.im/resin-io/chat.png)](https://gitter.im/resin-io/chat)

Execute device spec operations.

Role
----

The intention of this module is to provide low level access to how Resin.io device specs configuration operations are executed.

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

Installation
------------

Install `resin-device-operations` by running:

```sh
$ npm install --save resin-device-operations
```

Documentation
-------------

<a name="module_operations.execute"></a>

### operations.execute(image, operations, options) ⇒ <code>EventEmitter</code>
This function returns an `EventEmitter` object that emits the following events:

- `state (Object state)`: When an operation is going to be executed. The state object contains the `operation` and the progress `percentage` (0-100).
- `stdout (String data)`: When an operation prints to stdout.
- `stderr (String data)`: When an operation prints to stderr.
- `burn (String state)`: When the `burn` operation emits progress state.
- `error (Error error)`: When an error happens.
- `end`: When all the operations are completed successfully.

**Kind**: static method of <code>[operations](#module_operations)</code>  
**Summary**: Execute a set of operations over an image  
**Access**: public  

| Param | Type | Description |
| --- | --- | --- |
| image | <code>String</code> | path to image |
| operations | <code>Array.&lt;Object&gt;</code> | array of operations |
| options | <code>Object</code> | configuration options |

**Example**  
```js
execution = operations.execute 'foo/bar.img', [
	command: 'copy'
	from:
		partition:
			primary: 1
		path: '/bitstreams/parallella_e16_headless_gpiose_7010.bit.bin'
	to:
		partition:
			primary: 1
		path: '/parallella.bit.bin'
	when:
		coprocessorCore: '16'
		processorType: 'Z7010'
,
	command: 'copy'
	from:
		partition:
			primary: 1
		path: '/bistreams/parallella_e16_headless_gpiose_7020.bit.bin'
	to:
		partition:
			primary: 1
		path: '/parallella.bit.bin'
	when:
		coprocessorCore: '16'
		processorType: 'Z7020'
],
	coprocessorCore: '16'
	processorType: 'Z7010'

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

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

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

execution.on 'end', ->
	console.log('Finished all operations')
```

Support
-------

If you're having any problem, please [raise an issue](https://github.com/resin-io-modules/resin-device-operations/issues/new) on GitHub and the Resin.io team will be happy to help.

Tests
-----

Run the test suite by doing:

```sh
$ npm test
```

Contribute
----------

- Issue Tracker: [github.com/resin-io-modules/resin-device-operations/issues](https://github.com/resin-io-modules/resin-device-operations/issues)
- Source Code: [github.com/resin-io-modules/resin-device-operations](https://github.com/resin-io-modules/resin-device-operations)

Before submitting a PR, please make sure that you include tests, and that [coffeelint](http://www.coffeelint.org/) runs without any warning:

```sh
$ gulp lint
```

License
-------

The project is licensed under the Apache 2.0 license.

---
_Source: https://npm.io/package/resin-device-operations · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
