aboutsummaryrefslogtreecommitdiffstats
path: root/examples/parse.coffee
blob: fbb93d045e510724c98b57e6d07f0cd03c62b475 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
fs = require 'fs'

{PSD} = require __dirname + '/../lib/psd.js'

PSD.DEBUG = true

if process.argv.length is 2
  console.log "Please specify an input file"
  process.exit()

psd = PSD.fromFile process.argv[2]
psd.parse()

data = psd.toJSON()

fs.writeFile __dirname + "/output.json", JSON.stringify(data, null, "\t"), (err) ->
  console.log "JSON data saved to output.json"