Skip to content
A little globber
Scala
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
project
src
.gitignore
LICENSE
README.md
build.sbt
package.json

README.md

Glob API for Scala.js

This is a Scala.js type-safe binding for glob

A little globber.

Build Dependencies

Build/publish the SDK locally

 $ sbt clean publish-local

Running the tests

Before running the tests the first time, you must ensure the npm packages are installed:

$ npm install

Then you can run the tests:

$ sbt test

Examples

Using Glob asynchronously via callbacks:
import io.scalajs.JSON
import io.scalajs.npm.glob._

Glob("**/*.scala", (err, files) => {
  println(s"files: ${JSON.stringify(files)}")
})
Using Glob asynchronously via promises:
import io.scalajs.JSON
import io.scalajs.npm.glob._
import scalajs.concurrent.JSExecutionContext.Implicits.queue

Glob.future("**/*.scala") foreach { files =>
  println(s"files: ${JSON.stringify(files)}")
}
Using Glob synchronously:
import io.scalajs.JSON
import io.scalajs.npm.glob._

val files = Glob.sync("**/*.scala", new GlobOptions())
println(s"files: ${JSON.stringify(files)}")
Using Glob as an instance:
import io.scalajs.JSON
import io.scalajs.npm.glob._

new Glob("**/*.scala", (err, files) => {
    println(s"files: ${JSON.stringify(files)}")
})
The output from all of the examples is identical:
files: ["src/main/scala/io/scalajs/npm/glob/Glob.scala","src/main/scala/io/scalajs/npm/glob/GlobOptions.scala",
"src/main/scala/io/scalajs/npm/glob/package.scala","src/test/scala/io/scalajs/npm/glob/GlobTest.scala"]

Artifacts and Resolvers

To add the Glob binding to your project, add the following to your build.sbt:

libraryDependencies += "io.scalajs.npm" %%% "glob" % "0.5.0"

Optionally, you may add the Sonatype Repository resolver:

resolvers += Resolver.sonatypeRepo("releases") 
You can’t perform that action at this time.