file-writer
A writable stream to save HLS playlists/segments as local files
Features
- Being used with other
hls-streams
objects, it provides a functionality to write every HLS related data (playlist and segments) to your local filesystem. - It determines the local path for each files based on the
uri
described in the HLS playlist. - The hostname contained in the
uri
will be ignored (e.g. "https://foo.bar/abc/def.m3u8" is translated into "{rootPath}/abc/def.m3u8")
Install
Usage
const createReadStream = ;const createUrlRewriter = ;const createFileWriter = ; // file-writerconst createTerminator = const src = ;const rewrite = ;const save = ;const dest = ; // Write all playlists/segments to your local filesystemsrc;
API
The features are built on top of the Node's transform streams.
createFileWriter([options])
Creates a new TransformStream
object.
params
Name | Type | Required | Default | Description |
---|---|---|---|---|
options | object | No | {} | See below |
options
Name | Type | Default | Description |
---|---|---|---|
rootPath | string | process.CWD() | The root directory in which all the files are stored |
storePlaylist | boolean | false | If true, the playlist files are also stored as local files |
return value
An instance of TransformStream
.