文件更改时避免自动重启服务器流星

时间:2016-01-03 08:44:12

标签: javascript node.js meteor

当我保存文件中的任何更改甚至插入空格时,流星立即重启,因此cpu总是以高频率运行。我该怎么办呢?任何人都有类似的问题吗?

1 个答案:

答案 0 :(得分:5)

您可以通过在客户端代码中的任何位置添加HCP(热代码推送)来禁用它:

    FileInputStream fileInputStream=null;

    File file = new File("yourfile");

    byteArray = new byte[(int) file.length()];

    try {
        //convert file into array of bytes
  fileInputStream = new FileInputStream(file);
  fileInputStream.read(bFile);
  fileInputStream.close();

  //convert array of bytes into file
  FileOutputStream fileOuputStream = 
              new FileOutputStream("C:\\testing2.txt"); 
  fileOuputStream.write(bFile);
  fileOuputStream.close();

  System.out.println("Done");
    }catch(Exception e){
        e.printStackTrace();
    }

完成此操作后,您需要手动刷新页面才能看到任何新的更改。

相关问题