"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Functional_1 = require("../../../../../../Class/Functional");
const _ids_1 = require("../../../../../_ids");
class DownloadText extends Functional_1.Functional {
    constructor(system) {
        super({
            i: ['text', 'name', 'mimetype', 'charset'],
            o: [],
        }, {}, system, _ids_1.ID_DOWNLOAD_TEXT);
    }
    async f({ text: text, name, mimetype, charset }, done, fail) {
        const { api: { file: { downloadText }, }, } = this.__system;
        try {
            await downloadText({ text, name, mimetype, charset });
        }
        catch (err) {
            fail(err.message);
            return;
        }
        done();
    }
}
exports.default = DownloadText;
//# sourceMappingURL=index.js.map