@lighthouse-web3/sdk
Version:
NPM package and CLI tool to interact with lighthouse protocol
26 lines (25 loc) • 1.04 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const kleur_1 = require("kleur");
const getNetwork_1 = require("./utils/getNetwork");
const Lighthouse_1 = __importDefault(require("../Lighthouse"));
async function default_1(fileId) {
try {
if (!getNetwork_1.config.get('LIGHTHOUSE_GLOBAL_API_KEY')) {
throw new Error('Please create api-key first: use api-key command');
}
if (!fileId) {
throw new Error('Please provide a file ID to delete.');
}
const response = await Lighthouse_1.default.deleteFile(getNetwork_1.config.get('LIGHTHOUSE_GLOBAL_API_KEY'), fileId);
console.log((0, kleur_1.green)('Success: ') + (0, kleur_1.yellow)(response.data.message));
}
catch (error) {
console.log((0, kleur_1.red)(error.message));
process.exit(0);
}
}
exports.default = default_1;