Skip to content
This repository has been archived by the owner on Jul 7, 2021. It is now read-only.

EXAMPLES

Oliver Foster edited this page Jun 22, 2017 · 6 revisions

Make a globs collection

var fsg = require("fs-glob");

var gcol = fsg({
    globs: "**",
    location: "./src"
});

Get file stats at location

var fsg = require("fs-glob");

var gcol = fsg({
    globs: "**",
    location: "./src"
});

gcol.stats().then(function(stats) {
    console.log(stats);
});

// or

fsg.stats({
    globs: "**",
    location: "./src"
}).then(function(stats) {
    console.log(stats);
});

Watch a src folder

var fsg = require("fs-glob");

var gcol = fsg({
    globs: "**",
    location: "./src"
});

gcol.watch(function(changes) {
    console.log(changes);
});

// or

fsg.watch({
    globs: "**",
    location: "./src"
}, function(changes) {
    console.log(changes);
});

Move a folder

var fsg = require("fs-glob");

var gcol = fsg({
    globs: "**",
    location: "./src"
});

gcol.move("./new_place").then(function(moved) {
    console.log(moved);
});

// or

fsg.move({
    to: "./new_place",
    globs: "**",
    location: "./src"
}).then(function(moved) {
    console.log(moved);
});