0.0.2 • Published 7 years ago

destring v0.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

destring

Build Status Dependency Status npm version Coverage Status

Configurable strings cache swaps between strings and their ID.

This package:

  1. knows strings to replace instead of sending the whole string
  2. can be pre-configured with strings
  3. can learn strings during communications
  4. can limit the number of strings in its cache
  5. can limit the bytes of strings stored in its cache

See packages:

  1. endeo
  2. enbyte
  3. debyte
  4. debytes

NOTE: placeholder

Install

npm install destring --save

Usage

    // get the builder
var buildDestring = require('destring')

  // build one we can train
  , destring = buildDestring({
    // by default, there are no limits
    limit: 101,      // limit by *number* of strings
    bytes: 10 * 1024,// limit by bytes of strings
    minLength: 4,    // min chars in string to learn it
    maxLength: 100,  // avoid "learning" very long strings
    // which strings should it know already.
    // by default, it knows none.
    strings: [
      'key1', 'some value'
    ]
  })

  // get `which` string this is in the cache, its ID
  , which = destring.string('key1')

  // get the original string based on the `which` (ID)
  , string = destring.id(which)


// can teach it some strings to replace at any time.
destring.add(strings)

MIT License

0.0.2

7 years ago

0.0.1

7 years ago

0.0.0

7 years ago