🚀 Launch Week Day 3:Introducing Supply Chain Attack Campaigns Tracking.Learn More →
Socket
Book a DemoInstallSign in
Socket

random-access-latency

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

random-access-latency

A random-access-storage instance that wraps another one and adds latency

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

random-access-latency

A random-access-storage instance that wraps another one and adds latency

npm install random-access-latency

Usage

const ral = require('random-access-latency')
const ram = require('random-access-memory')

// use ral to wrap another storage instance and add latency

// add between 50 and 100ms latency to each operation
const storage = ral([50, 100], ram())

// should have latency
storage.write(42, Buffer.from('hi'), function () {
  storage.read(42, 2, console.log)
})

API

storage = ral(latency, otherStorage)

Wrap another store in random-access-storage instance that adds latency to all operations. If latency is an array a random latency is picked between the first and second number in the array.

License

MIT

FAQs

Package last updated on 23 Apr 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts