diff --git a/filechunker.js b/filechunker.js new file mode 100644 index 0000000..8cd2285 --- /dev/null +++ b/filechunker.js @@ -0,0 +1,26 @@ +fs=require("fs") + +class FileChunker { + constructor(fname) { + this.Chunks=[]; + let Template=fs.readFileSync(fname).toString(); + let pattern=""; + let offset=0; + do { + let nextOffset=Template.indexOf(pattern,offset); + console.log("Nextoffset:"+nextOffset); + if (nextOffset>=0) { + this.Chunks.push(Template.substring(offset,nextOffset)); + offset=nextOffset+pattern.length; + console.log("Offset:"+offset); + } + else { + this.Chunks.push(Template.substring(offset)); + offset=-1; + } + } while (offset>0); + } +} + +module.exports=FileChunker; + diff --git a/plurvote.html b/plurvote.html index 05055c7..bdd5ac1 100644 --- a/plurvote.html +++ b/plurvote.html @@ -26,7 +26,7 @@