fs-slicer
v1.0.7
Published
node file slice tool
Downloads
4
Maintainers
Readme
file-slice
Read chunk from file or join files from blocks tool.
Install
npm i fs-slicer --save
Example
const fileSlice = require("fs-slicer");
async function test() {
const sourFilePath = "a.exe";
const distFilePath = "./tmp/b.exe";
const buffInfoArray = fileSlice.getSliceInfoArr(sourFilePath);
console.log(buffInfoArray);
const blockArr = [];
for (const info of buffInfoArray) {
const buf=await fileSlice.readOneBlock(sourFilePath, info);
blockArr.push(buf);
}
await fileSlice.joinBlcoksToFile(distFilePath,blockArr);
}
test().then(()=>{});
APIs
//get slice info but not real slice
getSliceInfoArr(sourFilePath):Array[{start:number,end:number}];
//read a block from file
readOneBlock(sourFilePath, info):Promise<Buffer>;
//join a file from blocks
joinBlcoksToFile(distFilePath,blockArr):Promise<void>;