UNPKG

node-djiparsetxt

Version:

command-line application that reads a DJI '.txt' file and outputs a json.

44 lines 1.85 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.OutputCommand = void 0; var fs_1 = __importDefault(require("fs")); var path_1 = __importDefault(require("path")); var Command_1 = require("./Command"); var OutputCommand = /** @class */ (function (_super) { __extends(OutputCommand, _super); function OutputCommand() { return _super !== null && _super.apply(this, arguments) || this; } OutputCommand.prototype.exec = function (options) { var file = options.file; var buffer = options.buffer; // use -o option to output to file or dir if (options.output !== null && options.output !== undefined) { // check if output opt is dir or path to file var basename = path_1.default.basename(file); file = path_1.default.join(options.output, basename); fs_1.default.writeFileSync(file, buffer); return; } console.log(buffer.toString()); }; return OutputCommand; }(Command_1.Command)); exports.OutputCommand = OutputCommand; //# sourceMappingURL=OutputCommand.js.map