Skip to content

buffermaker is a convenient way of creating binary strings

License

Notifications You must be signed in to change notification settings

scalajs-io/buffermaker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BufferMaker API for Scala.js

buffermaker - A buffermaker is a convenient way of creating binary strings.

Description

A convenient way of creating binary strings in node.js because Buffer is a bit too low-level for comfort in this regard.

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

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>

Artifacts and Resolvers

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

About

buffermaker is a convenient way of creating binary strings

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages