Skip to content
This repository has been archived by the owner on Jul 7, 2021. It is now read-only.
Oliver Foster edited this page Sep 8, 2017 · 12 revisions

Import API

var fsg = require("fs-glob")

Globs Collections

fsg(globs, [location], [pwd]) // returns a GlobsCollection
fsg({
   globs: [ // Minimatch globs
      "**",
      "*.json"
   ],
   location: "./", // Relative location of globs
   pwd: undefined // Absolute working directory, assumed process.cwd
}) // returns a GlobsCollection

Watches Singleton

Watches:fsg.watches // An array of all current Watch objects

fsg.pause() // Pause all Watch objects
fsg.play() // Restart all Watch objects
fsg.stop() // Unregister and destroy all Watch objects

Utility

fsg.posix(location) // Convert Windows slashes to Unix slashes \ to /
fsg.mkdir(location, relativeToLocation) // Recursive make directory
fsg.abs(location, relativeToLocation) // Convert location to absolute
fsg.rel(location, relativeToLocation) // Convert location to relative
fsg.home() // Get user's home location
fsg.cwd() // Get current working directory
fsg.norm(location) // Perform fsg.posix and path.posix.normalize on location
fsg.join(location, location, ...) // Short for path.posix.join
fsg.stat(location, options) // Fetch, cache, update(options) Stat object for location

Shortcuts

fsg.stats(options) // fsg(options).stats(options), returns Promise  
fsg.collate(options) // fsg(options).collate(options), returns Promise  
fsg.move(options) // fsg(options).move(options), returns Promise  
fsg.copy(options) // fsg(options).copy(options), returns Promise  
fsg.delete(options) // fsg(options).delete(options), returns Promise  
fsg.watch(options, callback) // fsg(options).watch(callback, options), returns Watch object

ENUMS

fsg.NEGATE = 0
fsg.DESCEND = 1
fsg.MATCH = 2
Clone this wiki locally