File automation framework for ants.
npm install antfarmAntfarm is a simple automation framework that aims to make file automation robust and scalable. 🐜





``sh`
$ npm install antfarm
`js
const Antfarm = require('antfarm'),
af = new Antfarm();
let hotfolder_a = af.createFolderNest("/var/hotfolders/a");
let pdf_folder = af.createFolderNest("/var/out/pdf");
let other_folder = af.createFolderNest("/var/out/others");
let tunnel = af.createTunnel("Simple pdf sorting workflow");
tunnel.watch(hotfolder_a);
tunnel.run((job, nest) => {
if(job.extension == "pdf"){
job.move(pdf_folder);
} else {
job.move(other_folder);
}
});
`
`js
// Old style
job.setName("myFile.pdf");
console.log(job.getName());
// New style, using TypeScript accessors
job.name = "myFile.pdf";
console.log(job.name);
``