# balena-image-fs

> Image filesystem manipulation utilities

Latest version **7.6.21** (published 2026-09-12) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install balena-image-fs
pnpm add balena-image-fs
yarn add balena-image-fs
bun add balena-image-fs
```

## Health

**Score 70/100 (B)** — status: active.

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

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 7.6.21 |
| Published | 2026-09-12 |
| First published | 2020-07-30 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=16 |
| Dependencies | 5 |
| Unpacked size | 47.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 10 |
| Author | Balena Ltd. |
| Maintainers | balena.io |
| Keywords | balena, fs, filesystem, device, image |

## Links

- npm: https://www.npmjs.com/package/balena-image-fs
- Repository: https://github.com/balena-io-modules/balena-image-fs
- Issues: https://github.com/balena-io-modules/balena-image-fs/issues
- npm.io page: https://npm.io/package/balena-image-fs

## Dependencies (5)

- [fatfs](https://npm.io/package/fatfs.md) ^0.10.8
- [ext2fs](https://npm.io/package/ext2fs.md) ^4.2.4
- [file-disk](https://npm.io/package/file-disk.md) ^8.0.1
- [typed-error](https://npm.io/package/typed-error.md) ^3.2.1
- [partitioninfo](https://npm.io/package/partitioninfo.md) ^6.0.3

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 7.6.21 (latest) — 2026-09-12
- 7.6.22-build-renovate-node-22-x-a50afb118aa6ed7e48cf6661031f0db06d195a6b-1 (build-renovate-node-22-x) — 2026-09-12
- 7.6.22-build-renovate-mocha-12-x-34cc1b2603ba26b1dc4707f85fed5d29e3b0a191-1 (build-renovate-mocha-12-x) — 2026-09-12
- 7.6.21-build-renovate-mocha-11-x-69d86651b8931ac6367706f192bc7af5876d2513-1 (build-renovate-mocha-11-x) — 2026-09-12
- 7.6.20-build-renovate-flowzonify-0-x-da1c9c70621cce263e2e92666a5d1ae6d25bce9f-1 (build-renovate-flowzonify-0-x) — 2026-09-09
- 7.6.20-build-renovate-node-24-x-bb4815564b85823a23842ad0a2281d8333bce270-1 (build-renovate-node-24-x) — 2026-07-11
- 7.6.19-build-joshbwlng-typescript-v6-b20afd3bda5094c22279d68522859f78cce21967-1 (build-joshbwlng-typescript-v6) — 2026-06-24
- 7.6.18-build-renovate-pin-dependencies-c9675bf740acca1f886d03bb7341cfb0e230c113-1 (build-renovate-pin-dependencies) — 2026-06-24
- 7.6.17-build-renovate-major-22-node-00349bb5e4e497ca75755c36ca13e809ce5411e3-1 (build-renovate-major-22-node) — 2026-03-26
- 7.6.17-build-renovate-major-24-node-52aeae3bcd96d048088ca9ea720e13bbd39964f0-1 (build-renovate-major-24-node) — 2026-03-26
- 7.6.16-build-kyle-revert-flowzone-to-master-7a3c065b3c45fdd7d97cbdb5b1f0924bf5c6132b-1 (build-kyle-revert-flowzone-to-master) — 2026-03-26
- 7.6.15-build-renovate-github-actions-37d4c6d0fbd912d6c190326575987131019c84ca-1 (build-renovate-github-actions) — 2026-03-26
- 7.6.1-build-add-npm-oidc-permissions-9b1999c37a0e8ef8bc0ac5e439e22bf8c7b2cdea-3 (build-add-npm-oidc-permissions) — 2026-02-19
- 7.6.0-build-add-explore-partition-faa87056ed9ced0dd7ed338f0a017a4628bb6802-1 (build-add-explore-partition) — 2026-01-13
- 7.5.3-build-renovate-major-11-mocha-adbbd26449df5607b75230df1d041f3db412f163-1 (build-renovate-major-11-mocha) — 2025-04-02
- … 156 more at https://npm.io/package/balena-image-fs/versions

## README

balena-image-fs
--------------

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

Balena.io image filesystem manipulation utilities.

Role
----

The intention of this module is to provide low level utilities to Balena.io operating system data partitions.

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

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

Install `balena-image-fs` by running:

```sh
$ npm install --save balena-image-fs
```

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


* [imagefs](#module_imagefs)
    * [~interact()](#module_imagefs..interact)
    * [~explorePartition(imagePath, partitionNames, exploreFn)](#module_imagefs..explorePartition) ⇒ <code>T</code>

<a name="module_imagefs..interact"></a>

### imagefs~interact()
**Kind**: inner method of [<code>imagefs</code>](#module_imagefs)  
**Summary**: Run a function with a node fs like interface for a partition  
**Example**  
```js
const contents = await interact('/foo/bar.img', 5, async (fs) => {
	return await promisify(fs.readFile)('/bar/qux');
});
console.log(contents);
```
<a name="module_imagefs..explorePartition"></a>

### imagefs~explorePartition(imagePath, partitionNames, exploreFn) ⇒ <code>T</code>
**Kind**: inner method of [<code>imagefs</code>](#module_imagefs)  
**Summary**: Allow a provided function to explore the contents of the
first found partition of an image  

| Param | Type | Description |
| --- | --- | --- |
| imagePath | <code>string</code> | pathname of image for search |
| partitionNames | <code>Array.&lt;string&gt;</code> | partitions to find |
| exploreFn | <code>function</code> | function for exploration |


Support
-------

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

Tests
-----

Run the test suite by doing:

```sh
$ npm test
```

Contribute
----------

- Issue Tracker: [github.com/balena-io-modules/balena-image-fs/issues](https://github.com/balena-io-modules/balena-image-fs/issues)
- Source Code: [github.com/balena-io-modules/balena-image-fs](https://github.com/balena-io-modules/balena-image-fs)

License
-------

The project is licensed under the Apache 2.0 license.

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