Neanderthals Programming Machines

    ram-chunker

    1.0.0 • Public • Published

    ram-chunker

    Rapid Asymmetric Maximum (RAM) is a high throughput, hash-less, byte shift-resistant content-defined chunking algorithm for data deduplication.

    This package is a JavaScript implementation of RAM as described in the paper "A new content-defined chunking algorithm for data deduplication in cloud storage".

    Installation

    npm install ram-chunker
    

    Usage

    Get chunk indices

    const { getCutPoints } = require("ram-chunker");
    
    const data = "This is a test sentence.";
    const windowSize = 4;
    const cutPoints = getCutPoints(data, windowSize);
    
    console.log(cutPoints); // [ 0, 7, 14, 19 ]

    Get chunks from indices

    const result = [];
    
    for (let i = 0; i < cutPoints.length; i++) {
      const cutPoint = cutPoints[i];
      const nextcutPoint = cutPoints[i + 1];
    
      result[result.length] = data.slice(cutPoint, nextcutPoint);
    }
    
    console.log(result); // [ 'This is', ' a test', ' sent', 'ence.' ]

    Install

    npm i ram-chunker

    DownloadsWeekly Downloads

    1

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    8.5 kB

    Total Files

    5

    Last publish

    Collaborators

    • adamdorogi