Skip to content

Node server support for delta encoding to save bandwidth

Notifications You must be signed in to change notification settings

wmsmacdonald/delta-cache-node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

delta-cache-node

Node server-side support for delta caching

Complies with the RFC 3229 delta encoding spec with googlediffjson encoded deltas, so it works with delta-cache-browser.

Getting Started

var createDeltaCache = require('delta-cache');

var deltaCache = createDeltaCache();
var server = http.createServer((req, res) => {
  deltaCache(req, res, 'sample dynamic response ' + new Date().toString());
});

API

createDeltaCache()

Returns a DeltaCache instance.

Class: DeltaCache

This class internally contains file versions that are saved to disk.

deltaCache.respondWithDeltaEncoding(req, res, data[, fileId][, callback])

Sends a response with data to the client, using delta encoding if possible. If fileId is not given, it defaults to the path of the request URL. The parameter fileId identifies the file in the server version history, so a second request to the same fileId will give a delta encoded response (provided the client cached the first).

All versions of data are stored in disk in the filesystem as temporary files, and will be deleted when the Node process exits. To see the implementation of the version cache, see delta-history.

About

Node server support for delta encoding to save bandwidth

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published