Skip to content

RediCat/node-djiparsetxt

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

139 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-djiparsetxt

npm NPM

Decrypts and parse DJI logs and outputs csv files, along other things. Based on djiparsetxt.

This package requires node version 10 or older. Basically the stable release.

Usage

From the terminal

The main use case for is through a terminal to create json version of logs.

The cli's format is:

	node-djiparsetxt FILE [FILE...] [OPTIONS]

Type node-djiparsetxt --help for more info on options.

Example to create a json file from a text log:

	node-djiparsetxt log1.txt > log1.json

If you want to output csv:

	node-djiparsetext log1.txt --csv > log1.csv

From a script

node-djiparsetxt supports usage as a library to integrate it to a bigger workflow or to create batch processing of log files.

Example script that prints preformatted json file from a log file:

const djiparsetxt = require('node-djiparsetxt');
const fs = require('fs');

const file_path = "path_to_log.txt";

fs.readFile(file_path, (err, data) => {
	if (err) throw err;
	console.log(JSON.stringify(djiparsetxt.parse_file(data), null, 4));
});

node-djiparsetxt Module

parse_file(buf: Buffer): ParsedOutput

Parse a given buffer and return an object of type ParsedOutput.

Parameters

  • buf: Buffer: Buffer instance of the file to parse.

Returns

An array of with the rows extracted from the file.


get_details(buf: Buffer): any

Get the details section of the given file.

Parameters

  • buf: Buffer: Buffer instance of the file to parse.

Returns

An object with properties and values from the details area.


get_header(buf: Buffer): IHeaderInfo

Get the header of the given file.

Parameters

  • buf: Buffer: Buffer instance of the file to parse.

Returns

IHeaderInfo structure from the file.

About

Decrypts and parse DJI logs in node.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 96.4%
  • JavaScript 2.6%
  • Other 1.0%