index.js
function (filename, fn) {

		fn = fn || function () {};

		this._image.pack().pipe(fs.createWriteStream(filename)).once('close', function () {
			this._image.removeListener('error', fn);
			fn(undefined, this);
		}.bind(this)).once('error', function (err) {
			this._image.removeListener('close', fn);
			fn(err, this);
		}.bind(this));
	}
function (filename, fn) {

		fn = fn || function () {};

		this._image.pack().pipe(fs.createWriteStream(filename)).once('close', function () {
			this._image.removeListener('error', fn);
			fn(undefined, this);
		}.bind(this)).once('error', function (err) {
			this._image.removeListener('close', fn);
			fn(err, this);
		}.bind(this));
	}
function ( filename , fn ) { fn = fn || function ( ) { } ; this . _image . pack ( ) . pipe ( fs . createWriteStream ( filename ) ) . once ( 'close' , function ( ) { this . _image . removeListener ( 'error' , fn ) ; fn ( undefined , this ) ; } . bind ( this ) ) . once ( 'error' , function ( err ) { this . _image . removeListener ( 'close' , fn ) ; fn ( err , this ) ; } . bind ( this ) ) ; }
Writes the image to the filesystem

@method writeImage
@param {string} filename Path to file
@param {function} fn Callback
Writes the image to the filesystem