Source

Source

The `Source` class represents a container for a HTTP resource or local file that can be consumed as a readable stream.

Constructor

# new Source(uri, optsnullable)

`Source` class constructor
Parameters:
Name Type Attributes Description
uri String
opts Object <nullable>
Properties
Name Type Attributes Description
id String <nullable>
cwd String <nullable>
stream Stream <nullable>
duration Number <nullable>
byteLength Number <nullable>
Source:

Extends

  • nanoresource

Members

# pathname :String

The absolute path name of the source uri.
Type:
  • String
Source:

Methods

# (static) from(uri, optsnullable) → {Source}

Creates a new `Source` instance from input where input may be another source in which the state is copied into a new instance. Input may be a `Track` instance in which the same applies to the `Source` instance the track points to.
Parameters:
Name Type Attributes Description
uri String | Source | Track | Object
opts Object <nullable>
Source:
Returns:
Type
Source

# (protected) _close(callback)

Implements the abstract `_close()` method for `nanoresource` Closes the source stream and resets internal state.
Parameters:
Name Type Description
callback function
Source:

# (protected) _open(callback)

Implements the abstract `_open()` method for `nanoresource` Opens the source stream and initializes internal state.
Parameters:
Name Type Description
callback function
Source:

# createReadStream(optsnullable) → {Stream}

Creates a read stream for the source URI.
Parameters:
Name Type Attributes Description
opts Object <nullable>
Source:
Returns:
Type
Stream

# (async) faststart() → {Buffer}

Create a faststart buffer from the Source
Source:
Returns:
Type
Buffer

# (async) isFaststart() → {Boolean}

Answers the age-old question: is my MPEG-4 container faststarted?
Source:
Returns:
Type
Boolean

# probe(optsnullable, callback)

Queries for properties about the source stream.
Parameters:
Name Type Attributes Description
opts Object <nullable>
callback function
Source:

# ready(callback)

Wait for source to be ready (opened) calling `callback()` when it is.
Parameters:
Name Type Description
callback function
Source:

# stat(callback)

An alias for `probe()`.
Parameters:
Name Type Description
callback function
Source:

# (async) toBuffer() → {Buffer}

Create a buffer from the Source
Source:
Returns:
Type
Buffer