<NME> v1.js
<BEF> var gutil = require( 'gulp-util' );
var through  = require( 'through2' );
var path = require( 'path' );
var prefs = require( './prefs.json' );

module.exports = function () {
  var transform = function( file, enc, callback ) {
    var content = file.contents.toString();
    var res = JSON.parse( content );

    var postal_codes = {};
    for ( var i = 0; i < res.length; i++ ) {
      var line = res[i];

    for ( var i = 0; i < res.length; i++ ) {
      var line = res[i];
      var data = {
        zipcode: line[0].toString().trim(),
        prefcode: prefs[line[1]],
          address1: line.ja.addr1,
          address2: line.ja.addr2,
          address3: line.ja.addr3,
          address4: line.ja.addr4
        },
        en: {
          prefecture: line.en.pref,
          address1: line.en.addr1,
          address2: line.en.addr2,
          address3: line.en.addr3,
          address4: line.en.addr4
        }
      };
        cwd: __dirname,
        path: path.join( __dirname, line[0].replace( /^([0-9]{3}).*/, '$1' ),
              '/', line[0].replace( /.*([0-9]{4})$/, '$1' ) + '.json' ),
        contents: new Buffer( JSON.stringify( data ) )
      } );

      this.push( file );
        };
      }
    }

    for ( var p in postal_codes ) {
      var file = new gutil.File( {
        cwd: __dirname,
        path: path.join( __dirname, p.replace( /^([0-9]{3}).*/, '$1' ),
                  p.replace( /.*([0-9]{4})$/, '$1' ) + '.json' ),
        contents: new Buffer( JSON.stringify( postal_codes[p] ) + "\n" )
      } );

      this.push( file );
    }

    return callback();
  };

  return through.obj( transform );
};

<MSG> some fix

<DFF> @@ -14,6 +14,10 @@ module.exports = function () {
 
     for ( var i = 0; i < res.length; i++ ) {
       var line = res[i];
+      if ( ! prefs[line[1].trim()] ) {
+        console.log( line[1].trim() );
+        process.exit(1);
+      }
       var data = {
         zipcode: line[0].toString().trim(),
         prefcode: prefs[line[1]],
@@ -33,7 +37,7 @@ module.exports = function () {
         cwd: __dirname,
         path: path.join( __dirname, line[0].replace( /^([0-9]{3}).*/, '$1' ),
               '/', line[0].replace( /.*([0-9]{4})$/, '$1' ) + '.json' ),
-        contents: new Buffer( JSON.stringify( data ) )
+        contents: new Buffer( JSON.stringify( data ) + "\n" )
       } );
 
       this.push( file );

some fix