@postfetch/core 0.2.4 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/download.d.ts +7 -4
- package/dist/hls.d.ts +15 -0
- package/dist/index.js +958 -21
- package/dist/internal.d.ts +18 -1
- package/dist/isobmff.d.ts +20 -0
- package/dist/pinterest.d.ts +2 -0
- package/dist/reddit.d.ts +2 -0
- package/dist/remux.d.ts +8 -0
- package/dist/soundcloud.d.ts +2 -0
- package/package.json +5 -2
- package/src/download.ts +72 -14
- package/src/hls.ts +120 -0
- package/src/internal.ts +15 -1
- package/src/isobmff.ts +85 -0
- package/src/pinterest.ts +237 -0
- package/src/postfetch.ts +19 -1
- package/src/reddit.ts +293 -0
- package/src/remux.ts +172 -0
- package/src/soundcloud.ts +127 -0
- package/src/youtube.ts +54 -5
package/dist/download.d.ts
CHANGED
|
@@ -14,11 +14,13 @@ export type Archive = {
|
|
|
14
14
|
mime: "application/zip";
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
17
|
-
* Fetch a single media item
|
|
17
|
+
* Fetch a single media item, ready to stream or buffer. A plain item streams
|
|
18
|
+
* straight from its CDN; a muxed item (one with {@link MediaItem.audio}) is
|
|
19
|
+
* downloaded as two streams and merged in-process, so its body is buffered.
|
|
18
20
|
*
|
|
19
21
|
* @param item A {@link MediaItem} from a {@link PostfetchResult}.
|
|
20
22
|
* @param options See {@link DownloadOptions}.
|
|
21
|
-
* @returns The upstream `Response`,
|
|
23
|
+
* @returns The upstream `Response`, or a buffered `Response` of the merged file.
|
|
22
24
|
* @throws {PostfetchError} If the CDN responds with a non-OK status.
|
|
23
25
|
*
|
|
24
26
|
* @example
|
|
@@ -38,8 +40,9 @@ export declare function download(item: MediaItem, options?: DownloadOptions): Pr
|
|
|
38
40
|
export declare function archive(result: PostfetchResult, options?: DownloadOptions): Promise<Archive>;
|
|
39
41
|
/**
|
|
40
42
|
* Turn a result into a ready-to-serve `Response`: a single item is streamed as
|
|
41
|
-
* its file, multiple items become a zip.
|
|
42
|
-
* `x-media-*` headers. This is what the
|
|
43
|
+
* its file (or, when muxed, merged and buffered), multiple items become a zip.
|
|
44
|
+
* Sets `content-disposition` and the `x-media-*` headers. This is what the
|
|
45
|
+
* showcase server and templates return.
|
|
43
46
|
*
|
|
44
47
|
* @param result A {@link PostfetchResult}.
|
|
45
48
|
* @param options See {@link DownloadOptions}.
|
package/dist/hls.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Net } from "./internal";
|
|
2
|
+
export type HlsVariant = {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
bandwidth: number;
|
|
6
|
+
url: string;
|
|
7
|
+
audioGroup: string | null;
|
|
8
|
+
};
|
|
9
|
+
export type HlsMaster = {
|
|
10
|
+
variants: HlsVariant[];
|
|
11
|
+
audio: Record<string, string>;
|
|
12
|
+
};
|
|
13
|
+
export declare function isMasterPlaylist(text: string): boolean;
|
|
14
|
+
export declare function parseMaster(text: string, baseUrl: string): HlsMaster;
|
|
15
|
+
export declare function assembleHls(net: Net, playlistUrl: string, headers: HeadersInit): Promise<Uint8Array>;
|