"use strict";
/* eslint-disable multiline-comment-style */
Object.defineProperty(exports, "__esModule", { value: true });
const shim_1 = require("../../../shim");
/**
 * Provides file system utilities for plugins.
 *
 * <span class="platform-desktop">desktop</span>
 */
class JoplinFs {
    /**
     * Extracts an archive to the specified directory. Currently only ZIP files
     * are supported.
     *
     * <span class="platform-desktop">desktop</span>
     *
     * @param sourcePath Path to the archive file to extract
     * @param destinationPath Path to the directory where the contents should be extracted
     * @returns List of entries extracted from the archive
     */
    async archiveExtract(sourcePath, destinationPath) {
        const entries = await shim_1.default.fsDriver().zipExtract({
            source: sourcePath,
            extractTo: destinationPath,
        });
        // Map to plain objects to ensure they can be serialized over IPC
        return entries.map(e => ({
            entryName: e.entryName,
            name: e.name,
        }));
    }
}
exports.default = JoplinFs;
//# sourceMappingURL=JoplinFs.js.map