Skip to content

What property can i use to set the function that download the hls data #1588

@John4650-hub

Description

@John4650-hub

My video hls data is stored at my MEGA account and MEGA provides an api that can be used to stream the download of that data. The function exposes the actual buffer data that is being downloaded. Below is a snippet of how it works

file.download((err, data) => {
  // data is buffer
})

This function downloads files using chunked multiple parallel connections to speed up downloading. Similar to the MEGA implementation it first loads a 128KB chunk, then a 256KB, increasing it until it reaches 1MB. You can use the options below to control that.

maxConnections: the number of parallel connections is defined (default: 4);
initialChunkSize: first chunk size, in bytes (default: 128KB);
chunkSizeIncrement: how many bytes to increment each time (default: 128KB);
maxChunkSize: maximum chunk size, in bytes (max 1MB);
returnCiphertext: if true the ciphertext will be returned, which can be decrypted later using decrypt low level function.
handleRetries: accepts a function to handle retries on chunk downloading errors, overrides the function defined by File.defaultHandleRetries;
forceHttps: if set to true will download using HTTPS, if set to false will download using HTTP. Default to false in the Node build and true in the browser build or if a Deno global is set.
The download function also support start and end options, like fs.createReadStream.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions