var fs = require('fs');fs.truncate('126.txt', 2, function(err){ if(err){ throw err; } console.log('文件内容截断成功');})truncate len,回车换行也算字符长度;