As above, how do I store in the file system?

I have tried these solutions, but I have still not got it right...
<https://gist.github.com/madhums/e749dca107e26d72b64d#file-base64-image-upload-js-L7>
<https://www.google.com.sg/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwiC-_K2yIPOAhVJRY8KHUq5D4oQFggcMAA&url=http%3A%2F%2Fstackoverflow.com%2Fquestions%2F17397319%2Fsave-canvas-as-jpg-to-desktop&usg=AFQjCNGADOLxAdsduTuK6d-ZcVzZRgGwWg&sig2=UPC0l9bSsPGASnCrM94unA>

All I need to save looks something like this.

```

Object {imageFormat: "image/jpeg", imageB64: "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgICAgMCAgIDAw…J3kdq5LxJM7X8ik5CyMB+dFFOPxGNT4DNJOetFFFbnCf/2Q=="}imageB64: "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQE...+dFFOPxGNT4DNJOetFFFbnCf/2Q=="imageFormat: "image/jpeg"__proto__: Object__defineGetter__: __defineGetter__()__defineSetter__: __defineSetter__()__lookupGetter__: __lookupGetter__()__lookupSetter__: __lookupSetter__()constructor: Object()hasOwnProperty: hasOwnProperty()isPrototypeOf: isPrototypeOf()propertyIsEnumerable: propertyIsEnumerable()toLocaleString: toLocaleString()toString: toString()valueOf: valueOf()get __proto__: __proto__()set __proto__: __proto__()

```

Copied the whole object there.. 

Just picking up Javascript so please be as detailed as possible.