LogoLogo
  • About
  • Installation
  • Update & migration
  • Configuration
    • Hostname
    • TLS / HTTPS
    • Database
    • Logging
    • API Security
    • Storage
      • Disk
      • In-memory
      • S3
    • RTMP
    • SRT
    • FFmpeg
    • Sessions
    • Metrics
    • Router
    • Debug
  • API Swagger-Documentation
  • API Clients
  • Web-Interface
  • Guides
    • Beginner
    • RTMP
    • SRT
    • Filesystems
  • General
    • Prometheus metrics
  • API
    • Login
    • Config
    • Log
    • Filesystem
      • Disk
      • In-memory
      • S3
    • Metrics
    • Sessions
    • Profiling
    • Ping
  • API / FFmpeg
    • Process
      • Command
      • Metadata
      • State
      • Probe
      • Report
    • Skills
    • Widget (Website)
  • API / RTMP
    • RTMP
  • API / SRT
    • SRT
  • Development
    • Architecture
    • Coding
    • Custom Docker images
    • Benchmark
    • Support
Powered by GitBook
On this page

Was this helpful?

Export as PDF
  1. API
  2. Filesystem

Disk

PreviousFilesystemNextIn-memory

Last updated 2 years ago

Was this helpful?

The disk filesystem gives access to the actual directory that has been provided in the configuration as . It accessible only for retrieval via HTTP under /.

curl http://127.0.0.1:8080/path/to/a/file.txt -o file.txt

Given that the requested file exists, the returned Content-Type is based solely on the file extension. For a list of known mime-types and their extensions see in the configuration.

Access

API

Create, Update

Example:

echo 'test' > example.txt && \
curl http://127.0.0.1:8080/api/v3/fs/disk/example.txt \
   -d @example.txt \
   -X PUT
from core_client import Client

client = Client(base_url="http://127.0.0.1:8080")
client.login()

client.v3_fs_put_file(
    name: "disk",
    path: "example.txt",
    data: b"test"
)

Path is the complete file path incl. file name (/a/b/c/1.txt).

import (
    "strings"
    "github.com/datarhei/core-client-go/v16"
)

client, _ := coreclient.New(coreclient.Config{
    Address: "https://127.0.0.1:8080",
})

data := strings.NewReader("test")
err := client.FilesystemAddFile("disk", "/example.txt", data)

The contents for the upload has to be provided as an io.Reader.

After the successful upload the file is available at /example.txt and /api/v3/fs/disk/example.txt.

Description:

Read

List all files

Listing all currently stored files is done by calling /api/v3/fs/disk. It also accepts the query parameters pattern, sort (name, size, or lastmod) and order (asc or desc). If none of the parameters are given, all files will be listed sorted by their last modification time in ascending order.

curl "http://127.0.0.1:8080/api/v3/fs/disk?sort=name&order=asc" \
   -X GET
from core_client import Client

client = Client(base_url="http://127.0.0.1:8080")
client.login()

core_memfs_list = client.v3_fs_get_file_list(name="disk")
print(core_memfs_list)
import (
    "fmt"
    "github.com/datarhei/core-client-go/v16"
)

client, _ := coreclient.New(coreclient.Config{
    Address: "https://127.0.0.1:8080",
})

files, err := client.FilesystemList("disk", "/*.", coreclient.SORT_NAME, coreclient.ORDER_ASC)

for _, file := range files {
    fmt.Printf("%+v\n", file)
}

Description:

Download a file

For downloading a file you have to specify the complete path and filename. The Content-Type will always be application/data.

Example:

curl http://127.0.0.1:8080/api/v3/fs/disk/example.txt \
   -X GET
from core_client import Client

client = Client(base_url="http://127.0.0.1:8080")
client.login()

core_memfs_file = client.v3_fs_get_file(
    name="disk",
    path="example.txt"
)
print(core_memfs_file)
import (
    "github.com/datarhei/core-client-go/v16"
)

client, _ := coreclient.New(coreclient.Config{
    Address: "https://127.0.0.1:8080",
})

data, err := client.FilesystemGetFile("disk", "/example.txt")
defer data.Close()

The returned data is an io.ReadCloser.

Description:

Delete

For deleting a file you have to specify the complete path and filename.

Example:

curl http://127.0.0.1:8080/api/v3/fs/disk/example.txt \
   -X DELETE
from core_client import Client

client = Client(base_url="http://127.0.0.1:8080")
client.login()

client.v3_fs_delete_file(
    name="disk",
    path="example.txt"
)
import (
    "github.com/datarhei/core-client-go/v16"
)

client, _ := coreclient.New(coreclient.Config{
    Address: "https://127.0.0.1:8080",
})

err := client.FilesystemDeleteFile("disk", "/example.txt")

Description:

Configuration

The contents of the disk filesystem at / are also accessible via the API in the same way as described above, but with the same protection as the API (see ) for all operations. It is also possible to list all files that are currently in the filesystem.

With the pattern parameter you can filter the list based on a , with the addition of the ** placeholder to include multiple subdirectories, e.g. listing all .ts file in the root directory has the pattern /*.ts, listing all .ts file in the whole filesystem has the pattern /**.ts.Example:

glob pattern
Disk
  • Access
  • API
  • Create, Update
  • Read
  • Delete
  • Configuration
storage.disk.dir
storage.mime_types
API-Security configuration