sizexceed
v0.2.1
Published
Find Size Exceeded Files
Downloads
9
Readme
sizexceed
Find Size Exceeded Files
Install
npm i sizexceed
Usage
Create Instance
const sizexceed = require("sizexceed");
// import sizexceed from "sizexceed";
const se = new sizexceed("./files");
.dir(path)
// change root dir to "./files/img"
se.dir("./files/img");
Add Filters
.filter({ name, max, min, ignore, only })
se.filter({
name: "Video Files Larger Than 1GB",
max: "1G", // or "1GB" or (1 * 1024 * 1024 * 1024)
only: [".mp4", ".avi", ".webm", ".m4v", ".mov"] // CaSe InSeNsItIvE
});
.max(size, { name, ignore, only })
se.max("100M", {
name: "Text Files Larger Than 100MB",
only: ".txt"
});
.min(size, { name, ignore, only })
se.min("10K", {
name: "Other Files Smaller Than 10KB",
ignore: [".txt"]
});
Do Tests
.test()
// After Adding Filters:
const result = se.test();
console.log(result);
// {
// passed: [ ... ]
// failed: [ ... ]
// }
.clear()
// Clear All Filters
se.clear();