buffermaker - A buffermaker is a convenient way of creating binary strings.
A convenient way of creating binary strings in node.js because Buffer is a bit too low-level for comfort in this regard.
$ 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
import io.scalajs.npm.buffermaker._
import io.scalajs.npm.bignum.BigNum
val someBuffer = new BufferMaker()
.UInt8(1)
.UInt16BE(2)
.UInt32BE(3)
.Int64BE(new BigNum("4")) // uses the BigNum library
.string("this is a test!")
.make()
println(someBuffer.toString()) //=> <Buffer 01 00 02 00 00 00 03 00 00 00 00 00 00 00 04 74 68 69 73 20 69 73 20 61 20 74 65 73 74 21>
To add the BufferMaker
binding to your project, add the following to your build.sbt:
libraryDependencies += "io.scalajs.npm" %%% "buffermaker" % "0.5.0"
Optionally, you may add the Sonatype Repository resolver:
resolvers += Resolver.sonatypeRepo("releases")