 
 espruino =
   reset: -> sendToSerial('reset();\n')
+  save: -> sendToSerial('save();\n')
   upload: (code) -> sendToSerial("{ #{code} }\n")
 
 module.exports =

  serialPort = new SerialPort(config.espruino.serialPort, { baudrate: 9600 }, false)

  serialPort.on 'error', (error) -> written.reject(error)

  serialPort.on 'data', (data) ->
    read += data.toString()

  serialPort.open ->
    serialPort.write message, (error) ->

    success = (output) -> deployed.resolve(output)
    error = (output) -> deployed.reject(output)

    espruino.reset()
        .then(-> espruino.upload(code))
        .then(-> espruino.save())
        .finally(-> clearInterval(progress))
        .done(success, error)

    deployed.promise


