Add API doc generator, improve documentation across the board

This commit is contained in:
Vanilagy
2025-09-03 18:11:43 +02:00
parent 9d70c4c605
commit a2a30c3e92
28 changed files with 2281 additions and 388 deletions
+17 -8
View File
@@ -11,6 +11,7 @@ import { Output } from './output';
/**
* Base class for targets, specifying where output files are written.
* @group Output targets
* @public
*/
export abstract class Target {
@@ -32,10 +33,11 @@ export abstract class Target {
/**
* A target that writes data directly into an ArrayBuffer in memory. Great for performance, but not suitable for very
* large files. The buffer will be available once the output has been finalized.
* @group Output targets
* @public
*/
export class BufferTarget extends Target {
/** Stores the final output buffer. Until the output is finalized, this will be null. */
/** Stores the final output buffer. Until the output is finalized, this will be `null`. */
buffer: ArrayBuffer | null = null;
/** @internal */
@@ -45,7 +47,8 @@ export class BufferTarget extends Target {
}
/**
* A data chunk for StreamTarget.
* A data chunk for {@link StreamTarget}.
* @group Output targets
* @public
*/
export type StreamTargetChunk = {
@@ -58,7 +61,8 @@ export type StreamTargetChunk = {
};
/**
* Options for StreamTarget.
* Options for {@link StreamTarget}.
* @group Output targets
* @public
*/
export type StreamTargetOptions = {
@@ -73,9 +77,12 @@ export type StreamTargetOptions = {
};
/**
* This target writes data to a WritableStream, making it a general-purpose target for writing data anywhere. It is
* also compatible with FileSystemWritableFileStream for use with the File System Access API. The WritableStream can
* also apply backpressure, which will propagate to the output and throttle the encoders.
* This target writes data to a [`WritableStream`](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream),
* making it a general-purpose target for writing data anywhere. It is also compatible with
* [`FileSystemWritableFileStream`](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemWritableFileStream) for
* use with the [File System Access API](https://developer.mozilla.org/en-US/docs/Web/API/File_System_API). The
* `WritableStream` can also apply backpressure, which will propagate to the output and throttle the encoders.
* @group Output targets
* @public
*/
export class StreamTarget extends Target {
@@ -84,6 +91,7 @@ export class StreamTarget extends Target {
/** @internal */
_options: StreamTargetOptions;
/** Creates a new {@link StreamTarget} which writes to the specified `writable`. */
constructor(
writable: WritableStream<StreamTargetChunk>,
options: StreamTargetOptions = {},
@@ -114,8 +122,9 @@ export class StreamTarget extends Target {
}
/**
* This target just discards all incoming data. It is useful for when you need an `Output` but extract data from it
* differently, for example through format-specific callbacks (`onMoof`, `onMdat`, ...) or encoder events.
* This target just discards all incoming data. It is useful for when you need an {@link Output} but extract data from
* it differently, for example through format-specific callbacks (`onMoof`, `onMdat`, ...) or encoder events.
* @group Output targets
* @public
*/
export class NullTarget extends Target {