From d7f397b2fd306e5db4630b6010a2dfef19045683 Mon Sep 17 00:00:00 2001 From: Rob Moran Date: Sun, 7 Jan 2018 21:09:39 +0000 Subject: [PATCH] Minor example updates --- examples/node.js | 2 +- examples/package.js | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/examples/node.js b/examples/node.js index 3230fc5..20f47df 100644 --- a/examples/node.js +++ b/examples/node.js @@ -188,7 +188,7 @@ function update() { if (image) return updateFirmware(dfu, device, image); }) .then(() => { - console.log("Update complete!"); + console.log("Update complete"); process.exit(); }) .catch(error => { diff --git a/examples/package.js b/examples/package.js index 1d18dc9..d55f8db 100644 --- a/examples/package.js +++ b/examples/package.js @@ -45,19 +45,19 @@ }; Package.prototype.load = function() { - try { - return JSZip.loadAsync(this.buffer) - .then(zipFile => { - this.zipFile = zipFile; + return JSZip.loadAsync(this.buffer) + .then(zipFile => { + this.zipFile = zipFile; + try { return this.zipFile.file("manifest.json").async("string"); - }) - .then(content => { - this.manifest = JSON.parse(content).manifest; - return this; - }); - } catch(e) { - throw new Error("Unable to find manifest, is this a proper DFU package?"); - } + } catch(e) { + throw new Error("Unable to find manifest, is this a proper DFU package?"); + } + }) + .then(content => { + this.manifest = JSON.parse(content).manifest; + return this; + }); }; Package.prototype.getImage = function(types) {