exceeddata-sdk-vdata 2.10.5-1 → 2.10.5-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,66 +1,66 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var vdatasdktest_1 = require("exceeddata-sdk-vdata"); // Replace with your module name
4
- var vdatasdktest_2 = require("exceeddata-sdk-vdata");
5
- var fs = require("fs");
6
- var path = require("path");
7
- function vswasc_handler(msgIndex) {
8
- // Extract the "2" from the 6th character (index 5)
9
- var hex_channel = msgIndex.substring(5, 6);
10
- // Convert the hex value to a decimal integer
11
- var decimal_channel = parseInt(hex_channel, 16);
12
- // Convert the decimal value to a string
13
- var decimal_channelStr = String(decimal_channel);
14
- // Check for specific prefixes and set the decimal_channelStr to "-1"
15
- if (msgIndex.startsWith("0x0200") ||
16
- msgIndex.startsWith("0x0201") ||
17
- msgIndex.startsWith("0x0600") ||
18
- msgIndex.startsWith("0x0601")) {
19
- decimal_channelStr = "-1";
20
- }
21
- // Extract the hex value starting from the 7th character
22
- var hex_msgId = msgIndex.substring(7); // e.g., "406"
23
- // Convert the hex value to a decimal integer
24
- var decimal_msgId = parseInt(hex_msgId, 16);
25
- // Convert the decimal value to a string
26
- var decimal_msgIdStr = String(decimal_msgId);
27
- // Return the result as a tuple of strings
28
- return [decimal_channelStr, decimal_msgIdStr];
29
- }
30
- var uint8arry = [];
31
- var inputPath = 'test.stf'; // inputPath
32
- var outputPath = inputPath + ".blf";
33
- if (fs.statSync(inputPath).isDirectory()) {
34
- var dirArr = fs.readdirSync(inputPath);
35
- dirArr.forEach(function (item) {
36
- if (item.endsWith('.vsw') || item.endsWith('.stf')) {
37
- var itemPath = path.join(inputPath, item);
38
- console.log('read ' + item);
39
- var readInput = fs.readFileSync(itemPath);
40
- uint8arry.push(new vdatasdktest_1.VDataByteReader(new Uint8Array(readInput)));
41
- }
42
- });
43
- }
44
- else {
45
- var readInput = fs.readFileSync(inputPath);
46
- uint8arry.push(new vdatasdktest_1.VDataByteReader(new Uint8Array(readInput)));
47
- }
48
- var rfactory = new vdatasdktest_1.VDataReaderFactory();
49
- rfactory.setDataReaders(uint8arry);
50
- rfactory.setSignals("");
51
- rfactory.setQueryStartTime(0);
52
- rfactory.setQueryEndTime(0);
53
- rfactory.setReadLivingData(true);
54
- rfactory.setQueryFilter(true);
55
- rfactory.setColumnExpandMode(vdatasdktest_1.DExpand.FULL); //DExpand.FLAT,DExpand.NONE
56
- var vreader = rfactory.open();
57
- try {
58
- var converter = new vdatasdktest_2.VswToBlfConverter();
59
- //const vswasc_handler: any = {}; // Replace with the actual handler type.
60
- var data = converter.convert(vreader, vswasc_handler);
61
- fs.writeFileSync(outputPath, Buffer.from(data));
62
- console.log("File written successfully.");
63
- }
64
- catch (error) {
65
- console.error("An error occurred:", error);
66
- }
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var vdatasdktest_1 = require("exceeddata-sdk-vdata"); // Replace with your module name
4
+ var vdatasdktest_2 = require("exceeddata-sdk-vdata");
5
+ var fs = require("fs");
6
+ var path = require("path");
7
+ function vswasc_handler(msgIndex) {
8
+ // Extract the "2" from the 6th character (index 5)
9
+ var hex_channel = msgIndex.substring(5, 6);
10
+ // Convert the hex value to a decimal integer
11
+ var decimal_channel = parseInt(hex_channel, 16);
12
+ // Convert the decimal value to a string
13
+ var decimal_channelStr = String(decimal_channel);
14
+ // Check for specific prefixes and set the decimal_channelStr to "-1"
15
+ if (msgIndex.startsWith("0x0200") ||
16
+ msgIndex.startsWith("0x0201") ||
17
+ msgIndex.startsWith("0x0600") ||
18
+ msgIndex.startsWith("0x0601")) {
19
+ decimal_channelStr = "-1";
20
+ }
21
+ // Extract the hex value starting from the 7th character
22
+ var hex_msgId = msgIndex.substring(7); // e.g., "406"
23
+ // Convert the hex value to a decimal integer
24
+ var decimal_msgId = parseInt(hex_msgId, 16);
25
+ // Convert the decimal value to a string
26
+ var decimal_msgIdStr = String(decimal_msgId);
27
+ // Return the result as a tuple of strings
28
+ return [decimal_channelStr, decimal_msgIdStr];
29
+ }
30
+ var uint8arry = [];
31
+ var inputPath = 'test.stf'; // inputPath
32
+ var outputPath = inputPath + ".blf";
33
+ if (fs.statSync(inputPath).isDirectory()) {
34
+ var dirArr = fs.readdirSync(inputPath);
35
+ dirArr.forEach(function (item) {
36
+ if (item.endsWith('.vsw') || item.endsWith('.stf')) {
37
+ var itemPath = path.join(inputPath, item);
38
+ console.log('read ' + item);
39
+ var readInput = fs.readFileSync(itemPath);
40
+ uint8arry.push(new vdatasdktest_1.VDataByteReader(new Uint8Array(readInput)));
41
+ }
42
+ });
43
+ }
44
+ else {
45
+ var readInput = fs.readFileSync(inputPath);
46
+ uint8arry.push(new vdatasdktest_1.VDataByteReader(new Uint8Array(readInput)));
47
+ }
48
+ var rfactory = new vdatasdktest_1.VDataReaderFactory();
49
+ rfactory.setDataReaders(uint8arry);
50
+ rfactory.setSignals("");
51
+ rfactory.setQueryStartTime(0);
52
+ rfactory.setQueryEndTime(0);
53
+ rfactory.setReadLivingData(true);
54
+ rfactory.setQueryFilter(true);
55
+ rfactory.setColumnExpandMode(vdatasdktest_1.DExpand.FULL); //DExpand.FLAT,DExpand.NONE
56
+ var vreader = rfactory.open();
57
+ try {
58
+ var converter = new vdatasdktest_2.VswToBlfConverter();
59
+ //const vswasc_handler: any = {}; // Replace with the actual handler type.
60
+ var data = converter.convert(vreader, vswasc_handler);
61
+ fs.writeFileSync(outputPath, Buffer.from(data));
62
+ console.log("File written successfully.");
63
+ }
64
+ catch (error) {
65
+ console.error("An error occurred:", error);
66
+ }
package/test/sdk_test.js CHANGED
@@ -1,82 +1,82 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var vdatasdktest_1 = require("exceeddata-sdk-vdata"); // Replace with your module name
4
- var fs = require("fs");
5
- var path = require("path");
6
- var uint8arry = [];
7
- var inputPath = 'test.stf'; // inputPath
8
- var outputPath = inputPath + ".csv";
9
- if (fs.statSync(inputPath).isDirectory()) {
10
- var dirArr = fs.readdirSync(inputPath);
11
- dirArr.forEach(function (item) {
12
- if (item.endsWith('.vsw') || item.endsWith('.stf')) {
13
- var itemPath = path.join(inputPath, item);
14
- console.log('read ' + item);
15
- var readInput = fs.readFileSync(itemPath);
16
- uint8arry.push(new vdatasdktest_1.VDataByteReader(new Uint8Array(readInput)));
17
- }
18
- });
19
- }
20
- else {
21
- var readInput = fs.readFileSync(inputPath);
22
- uint8arry.push(new vdatasdktest_1.VDataByteReader(new Uint8Array(readInput)));
23
- }
24
- var rfactory = new vdatasdktest_1.VDataReaderFactory();
25
- rfactory.setDataReaders(uint8arry);
26
- rfactory.setSignals("");
27
- rfactory.setQueryStartTime(0);
28
- rfactory.setQueryEndTime(0);
29
- rfactory.setReadLivingData(true);
30
- rfactory.setQueryFilter(true);
31
- rfactory.setColumnExpandMode(vdatasdktest_1.DExpand.FULL); //DExpand.FLAT,DExpand.NONE
32
- var vreader = rfactory.open();
33
- var dataframe = vreader.df();
34
- var keys = dataframe.cols(true);
35
- var type = "values";
36
- var values;
37
- var densifyRowsAhead = 0;
38
- var densifyOutputItv = 0;
39
- if (type === "values") {
40
- console.log("calling values() interface");
41
- values = dataframe.values(densifyRowsAhead, densifyOutputItv);
42
- }
43
- else if (type === "objects") {
44
- console.log("calling objects() interface");
45
- values = dataframe.objects(densifyRowsAhead, densifyOutputItv);
46
- }
47
- else if (type === "object1s") {
48
- console.log("calling object1s() interface");
49
- values = dataframe.object1s();
50
- }
51
- else {
52
- console.error("Unsupported type: ".concat(type, ", using values by default"));
53
- values = dataframe.values(densifyRowsAhead, densifyOutputItv);
54
- }
55
- console.log("keys number: ".concat(keys.length, ", row num: ").concat(values.length));
56
- var str = keys.join(", ") + "\n";
57
- for (var i = 0; i < Math.min(values.length, 200000); i++) {
58
- var row = values[i];
59
- var line = row.map(function (item) {
60
- if (item === null) {
61
- return "";
62
- }
63
- else if (item instanceof Buffer || item instanceof Uint8Array) {
64
- return "\"[".concat(Array.from(item).join(","), "]\"");
65
- }
66
- else if (Array.isArray(item)) {
67
- return "\"[".concat(item.join(","), "]\"");
68
- }
69
- else if (item instanceof Map) {
70
- var entries = Array.from(item.entries()).map(function (_a) {
71
- var key = _a[0], value = _a[1];
72
- return "'".concat(key, "':'").concat(value, "'");
73
- });
74
- return "\"{".concat(entries.join(", "), "}\"");
75
- }
76
- else {
77
- return item.toString();
78
- }
79
- }).join(",");
80
- str += line + "\n";
81
- }
82
- fs.writeFileSync(outputPath, str);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var vdatasdktest_1 = require("exceeddata-sdk-vdata"); // Replace with your module name
4
+ var fs = require("fs");
5
+ var path = require("path");
6
+ var uint8arry = [];
7
+ var inputPath = 'test.stf'; // inputPath
8
+ var outputPath = inputPath + ".csv";
9
+ if (fs.statSync(inputPath).isDirectory()) {
10
+ var dirArr = fs.readdirSync(inputPath);
11
+ dirArr.forEach(function (item) {
12
+ if (item.endsWith('.vsw') || item.endsWith('.stf')) {
13
+ var itemPath = path.join(inputPath, item);
14
+ console.log('read ' + item);
15
+ var readInput = fs.readFileSync(itemPath);
16
+ uint8arry.push(new vdatasdktest_1.VDataByteReader(new Uint8Array(readInput)));
17
+ }
18
+ });
19
+ }
20
+ else {
21
+ var readInput = fs.readFileSync(inputPath);
22
+ uint8arry.push(new vdatasdktest_1.VDataByteReader(new Uint8Array(readInput)));
23
+ }
24
+ var rfactory = new vdatasdktest_1.VDataReaderFactory();
25
+ rfactory.setDataReaders(uint8arry);
26
+ rfactory.setSignals("");
27
+ rfactory.setQueryStartTime(0);
28
+ rfactory.setQueryEndTime(0);
29
+ rfactory.setReadLivingData(true);
30
+ rfactory.setQueryFilter(true);
31
+ rfactory.setColumnExpandMode(vdatasdktest_1.DExpand.FULL); //DExpand.FLAT,DExpand.NONE
32
+ var vreader = rfactory.open();
33
+ var dataframe = vreader.df();
34
+ var keys = dataframe.cols(true);
35
+ var type = "values";
36
+ var values;
37
+ var densifyRowsAhead = 0;
38
+ var densifyOutputItv = 0;
39
+ if (type === "values") {
40
+ console.log("calling values() interface");
41
+ values = dataframe.values(densifyRowsAhead, densifyOutputItv);
42
+ }
43
+ else if (type === "objects") {
44
+ console.log("calling objects() interface");
45
+ values = dataframe.objects(densifyRowsAhead, densifyOutputItv);
46
+ }
47
+ else if (type === "object1s") {
48
+ console.log("calling object1s() interface");
49
+ values = dataframe.object1s();
50
+ }
51
+ else {
52
+ console.error("Unsupported type: ".concat(type, ", using values by default"));
53
+ values = dataframe.values(densifyRowsAhead, densifyOutputItv);
54
+ }
55
+ console.log("keys number: ".concat(keys.length, ", row num: ").concat(values.length));
56
+ var str = keys.join(", ") + "\n";
57
+ for (var i = 0; i < Math.min(values.length, 200000); i++) {
58
+ var row = values[i];
59
+ var line = row.map(function (item) {
60
+ if (item === null) {
61
+ return "";
62
+ }
63
+ else if (item instanceof Buffer || item instanceof Uint8Array) {
64
+ return "\"[".concat(Array.from(item).join(","), "]\"");
65
+ }
66
+ else if (Array.isArray(item)) {
67
+ return "\"[".concat(item.join(","), "]\"");
68
+ }
69
+ else if (item instanceof Map) {
70
+ var entries = Array.from(item.entries()).map(function (_a) {
71
+ var key = _a[0], value = _a[1];
72
+ return "'".concat(key, "':'").concat(value, "'");
73
+ });
74
+ return "\"{".concat(entries.join(", "), "}\"");
75
+ }
76
+ else {
77
+ return item.toString();
78
+ }
79
+ }).join(",");
80
+ str += line + "\n";
81
+ }
82
+ fs.writeFileSync(outputPath, str);
@@ -1,8 +1,8 @@
1
- export function sprintf(key: any, ...args: any[]): string;
2
- export function vsprintf(fmt: any, argv: any): any;
3
- export class VswToAscConverter {
4
- convert(reader: any, colParser: any): string;
5
- }
6
- export class VswToBlfConverter {
7
- convert(reader: any, colParser: any): any;
8
- }
1
+ export function sprintf(key: any, ...args: any[]): string;
2
+ export function vsprintf(fmt: any, argv: any): any;
3
+ export class VswToAscConverter {
4
+ convert(reader: any, colParser: any): string;
5
+ }
6
+ export class VswToBlfConverter {
7
+ convert(reader: any, colParser: any): any[];
8
+ }
package/types/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from "./vdata-2.10.0";
2
- export * from "./blf-2.10.0";
1
+ export * from "./vdata-2.10.0";
2
+ export * from "./blf-2.10.0";