8 lines
449 B
JavaScript
8 lines
449 B
JavaScript
// Local JSON -> TOON conversion using the already installed tg-cli dependency.
|
|
import { createRequire } from 'node:module';
|
|
import { realpathSync, readFileSync } from 'node:fs';
|
|
import { pathToFileURL } from 'node:url';
|
|
|
|
const require = createRequire(realpathSync(process.argv[2]));
|
|
const { encode } = await import(pathToFileURL(require.resolve('@toon-format/toon')).href);
|
|
process.stdout.write(encode(JSON.parse(readFileSync(0, 'utf8'))) + '\n');
|