Skip to content

scalajs-io/filed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Filed API for Scala.js

filed - Simplified file library.

Description

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.

Build Requirements

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

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))

Artifacts and Resolvers

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") 

Releases

No releases published

Packages

No packages published

Languages