Move user-config-json-to-bin.ts to the usb package and use import instead of require.
This commit is contained in:
13
packages/usb/user-config-json-to-bin.ts
Normal file
13
packages/usb/user-config-json-to-bin.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { UhkBuffer, UserConfiguration } from '../uhk-common/src/config-serializer/index';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const inputFile = process.argv[2];
|
||||
console.log(inputFile);
|
||||
const outputFile = process.argv[3];
|
||||
|
||||
const config1Js = JSON.parse(fs.readFileSync(inputFile));
|
||||
const config1Ts: UserConfiguration = new UserConfiguration().fromJsonObject(config1Js);
|
||||
const config1Buffer = new UhkBuffer();
|
||||
config1Ts.toBinary(config1Buffer);
|
||||
const config1BufferContent = config1Buffer.getBufferContent();
|
||||
fs.writeFileSync('user-config.bin', config1BufferContent);
|
||||
Reference in New Issue
Block a user