当前位置 : 主页 > 网络编程 > JavaScript >

分割 HTML(split.js)

来源:互联网 收集:自由互联 发布时间:2021-06-28
split.js var fs = require('fs');try {fs.mkdirSync('out');}catch(ex){}var co = fs.readFileSync('out.html', 'utf-8');var files = co.split(/ /g);for(var i = 0; i files.length; i++){fs.writeFileSync('out/' + i + '.html', files[i], {encoding: 'u
split.js
var fs = require('fs');

try {fs.mkdirSync('out');}
catch(ex){}

var co = fs.readFileSync('out.html', 'utf-8');

var files = co.split(/
 /g);

for(var i = 0; i < files.length; i++)
{
	fs.writeFileSync('out/' + i + '.html', files[i], {encoding: 'utf-8'});
}
网友评论