const process = require('process')

const fs = require('fs')
const createVerge1VspLoader = require('../loader/createVerge1VspLoader')
const createVerge1VspConverter = require('../converter/createVerge1VspConverter')

const vspFilename = process.argv[2]
fs.readFile(vspFilename, (err, data) => {
  const loader = createVerge1VspLoader({data})
  const vsp = loader.load()
  const converter = createVerge1VspConverter(vsp)
  const png = converter.convertToPng()
  const targetFilename = vspFilename + '.png'

  png.pack().pipe(fs.createWriteStream(targetFilename))

  console.log('converted', vspFilename, 'to', targetFilename)
})

@@ -246,16 +246,29 @@
 argv%5B2%5D%0A
+const data = 
 fs.readF
@@ -270,16 +270,20 @@
 readFile
+Sync
 (vspFile
@@ -290,29 +290,10 @@
 name
-, (err, data) =%3E %7B%0A  
+)%0A
 cons
@@ -333,18 +333,16 @@
 %7Bdata%7D)%0A
-  
 const vs
@@ -359,18 +359,16 @@
 .load()%0A
-  
 const co
@@ -407,18 +407,16 @@
 er(vsp)%0A
-  
 const pn
@@ -444,18 +444,16 @@
 ToPng()%0A
-  
 const ta
@@ -489,18 +489,16 @@
 '.png'%0A%0A
-  
 png.pack
@@ -548,10 +548,8 @@
 ))%0A%0A
-  
 cons
@@ -604,11 +604,8 @@
 lename)%0A
-%7D)%0A

use sync file readers in cli