filed - Simplified file library.
Super simple to use
Filed does a lazy stat call so you can actually open a file and begin writing to it and if the file isn't there it will just be created.
$ sbt clean publish-local
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
If you pipe it to a destination it'll be a read stream.
import io.scalajs.nodejs.fs.Fs
import io.scalajs.npm.filed._
Filed("/myfile").pipe(Fs.createWriteStream("/out"))
And of course you can pipe a filed object from itself to itself and it'll figure it out.
import io.scalajs.npm.filed._
Filed("/myfile").pipe(Filed("/newfile"))
Those familiar with request will be familiar seeing object capability detection when doing HTTP.
Filed
does this as well.
import io.scalajs.nodejs.http.Http
import io.scalajs.npm.filed._
Http.createServer((req, resp) => Filed("/data.json").pipe(resp))
To add the Filed
binding to your project, add the following to your build.sbt:
libraryDependencies += "io.scalajs.npm" %%% "filed" % "0.5.0"
Optionally, you may add the Sonatype Repository resolver:
resolvers += Resolver.sonatypeRepo("releases")