JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q21291F

add the encoding ability to abstract-nosql database.

Package Exports

  • nosql-encoding

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (nosql-encoding) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Nosql Encoding Ability.

Build Status

NPM

Add the encoding ability to the abstract-nosql database.

Usage

Add the Encoding ability to a nosql database

npm install nosql-encoding
npm install encoding-iterator
var Encoding = require("nosql-encoding")
var LevelDB  = Encoding(require("leveldown-sync"))

var db = LevelDB('location')
db.open({keyEncoding: 'text', valueEncoding: 'json'})

Develop a nosql database with encoding ability

Coffee-Script:


inherits      = require('abstract-object/util').inherits
EncodingNoSQL = require('nosql-encoding')

class MyDatabase
    inherits MyDatabase, EncodingNoSQL

Encoding Codec

See buffer-codec.

Codec List:

  • Text Codec: encode via toString() , decode return the data directly.
    • Json Codec: encode via JSON.stringify(.toJSON), decode via JSON.parse
    • Hex Codec: hex string to Binary.
  • Binary Codec:
    • encodeBuffer: encode string or array to a buffer.
    • decodeBuffer: return the buffer directly.
    • encodeString:
      • result is the same string if value is string
      • result is ascii string if value is array, the number element in array saved is (element & 0xFF) if element is not number, saved 0 instead.
    • decodeString: return the same string.