#!/usr/bin/env node; /****************************************************************************** * This program simply writes lines with the alphabet to a file. * * Copyright © 2020 Richard Lesh. All rights reserved. *****************************************************************************/ const Utils = require('./Utils'); const fs = require('fs'); async function writeTextFile(filespec) { let ofh = fs.createWriteStream(filespec, "UTF-8"); if (ofh == null) { throw new Utils.IOError("Problem opening output file!"); } ofh.write("ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "\n"); ofh.write("ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ" + "\n"); ofh.write("АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ" + "\n"); ofh.write("゠ァアィイゥウェエォオカガキギクグケゲコゴサザシジスズセゼソゾタ" + "\n"); ofh.write("ダチヂッツヅテデトドナニヌネノハバパヒビピフブプヘベペホボポマミ" + "\n"); ofh.write("ムメモャヤュユョヨラリルレロヮワヰヱヲンヴヵヶヷヸヹヺ・ーヽヾヿ" + "\n"); } const main = async () => { if (process.argv.length != 3) { console.log(["Syntax: ", Utils.filename(process.argv[1]), " {filename}"].join('')); process.exit(1); } const FILESPEC = process.argv[2]; try { await writeTextFile(FILESPEC); } catch (ex) { if (ex instanceof Utils.IOError) { console.log(["Error: ", String(ex)].join('')); } else if (ex instanceof Error) { console.log("Unexpected File Write Error"); } } } main().catch( e => { console.error(e) } );