1. immediate-chunk-store
Immediate put/get for abstract-chunk-store compliant stores
immediate-chunk-store
Package: immediate-chunk-store
Created by: feross
Last modified: Sun, 19 Jun 2022 00:46:32 GMT
Version: 2.2.0
License: MIT
Downloads: 13,803
Repository: https://github.com/feross/immediate-chunk-store

Install

npm install immediate-chunk-store
yarn add immediate-chunk-store

immediate-chunk-store ci npm downloads javascript style guide

Immediate put/get for abstract-chunk-store compliant stores

abstract chunk store

Makes store.put() chunks immediately available for store.get(), even before the
store.put() callback is called. Data is stored in memory until the store.put()
is complete.

Install

npm install immediate-chunk-store

Usage

 var ImmediateChunkStore = require('immediate-chunk-store')
var FSChunkStore = require('fs-chunk-store') // any chunk store will work

var store = new ImmediateChunkStore(new FSChunkStore(10))

store.put(0, Buffer.from('abc'), function () { /* yolo */ })

// And now, get the same chunk out BEFORE the put is complete
store.get(0, function (err, data) {
  if (err) throw err
  console.log(data.toString()) // 'abc'
})

License

MIT. Copyright (c) Feross Aboukhadijeh.

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code