List Files

Method

$api->list_files

Parameters

Response

array [
  array [
    "type" => string "file|folder",
    "oid" => string,
    "size" => int,
    "path" => string
  ]
]

Example

Pretty-print all files in the root directory of a the username/repo model.

<?php
include 'hub.php';
$api = new Hub('hf_***');
$files = ($api->list_files('username/repo'));
foreach ($files as $file) {
    echo $file['type'] . ': ' . $file['path'] . ' (' . $file['size'] . ')' . "\n";
}