UNPKG

balena-image-fs

Version:
27 lines (26 loc) 1.03 kB
import * as Fs from 'fs'; import { Disk } from 'file-disk'; export { getFsLabel, LabelNotFound } from './fsLabel'; export { findPartition, FindPartitionResult } from './utils'; /** * @summary Run a function with a node fs like interface for a partition * * @example * * const contents = await interact('/foo/bar.img', 5, async (fs) => { * return await promisify(fs.readFile)('/bar/qux'); * }); * console.log(contents); * */ export declare function interact<T>(disk: Disk | string, partition: number | undefined, fn: (fs: typeof Fs) => Promise<T>): Promise<T>; /** * @summary Allow a provided function to explore the contents of the * first found partition of an image * * @param {string} imagePath - pathname of image for search * @param {string[]} partitionNames - partitions to find * @param {function(fs): Promise<T>} - function for exploration * @returns {T} */ export declare function explorePartition<T>(imagePath: string, partitionNames: string[], exploreFn: (fs: typeof Fs) => Promise<T>): Promise<T>;