Glen Whitney
67a07e2000
Add the civet and typescript compilers, implement a build step, provide examples of using from es6, script, and command line. Of course, there is no actual behavior produced; convert always produces 'foo' at the moment.
24 lines
608 B
JavaScript
Executable File
24 lines
608 B
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
import {convert} from './index.js'
|
|
import {stdin, argv} from 'node:process'
|
|
|
|
async function streamToString(stream) {
|
|
// lets have a ReadableStream as a stream variable
|
|
const chunks = [];
|
|
|
|
for await (const chunk of stream) {
|
|
chunks.push(Buffer.from(chunk));
|
|
}
|
|
|
|
return Buffer.concat(chunks).toString("utf-8");
|
|
}
|
|
|
|
if (argv.length > 2) {
|
|
console.log('Usage: vrml1to97 < old.wrl > shinynew.wrl')
|
|
console.log(' Translates VRML 1.0 on standard input to VRML97 on standard out.')
|
|
} else {
|
|
const input = await streamToString(stdin)
|
|
console.log(convert(input))
|
|
}
|