New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@ddatabase/byte-stream

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ddatabase/byte-stream

A Readable stream wrapper around DDatabase that supports reading byte ranges.

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

@ddatabase/byte-stream

A Readable stream wrapper around dDatabase that supports reading byte ranges.

When provided with optional start/end block heuristics, this module will efficiently sync only those blocks which contain the specified range.

Supports asynchronously specifying stream options, as well as the input feed, to remove the need for additional stream management modules like duplexify.

Most of the code has been extracted from dDrive.

Usage

The following example will return a byte stream of the entire input feed.

const ram = require('random-access-memory')
const ddatabase = require('ddatabase')
const createByteStream = require('@ddatabase/byte-stream')

let base = ddatabase(ram)
let stream = createByteStream({
  feed: base
})

API

stream = createStream([options])

Creates a new byte stream.

If specified, options can include:

{
  feed: base, // A dDatabase.
  byteOffset: 0, // Starting offset in bytes from the start of the feed.
  byteLength: 10, // The number of bytes to read.
  blockOffset: 0, // An optional starting block heuristic (optimization).
  blockLength: 10 // An optional block length that should contain the entire range (optimization).
}

stream.start([options])

Starts downloading and streaming according to the specified options.

Options are the same as in createStream. If a feed was specified in the stream constructor, then one should not provide another stream in the start options.

License

MIT

Keywords

ddatabase

FAQs

Package last updated on 26 Mar 2021

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