Filesharing Service File Details Task¤
task api name:
file_details
The file_details task returns metadata about a file, including existence status, size in bytes, and MD5 hash. Use it to verify file integrity or check a file before downloading it.
Inputs¤
| Parameter | Required | Description |
|---|---|---|
url |
Yes | File URL to inspect |
Output¤
Returns metadata for the requested file, including whether it exists, its size, and its MD5 hash when available.
Examples¤
Show file details:
nf#file details url nf://filesharing/test_file_1.txt
Context manager:
from norfab.core.nfapi import NorFab
with NorFab(inventory="./inventory.yaml") as nf:
client = nf.make_client()
result = client.run_job(
service="filesharing",
task="file_details",
workers="any",
kwargs={"url": "nf://filesharing/test_file_1.txt"},
)
print(result)
Direct lifecycle:
from norfab.core.nfapi import NorFab
nf = NorFab(inventory="./inventory.yaml")
try:
nf.start()
client = nf.make_client()
result = client.run_job(
service="filesharing",
task="file_details",
workers="any",
kwargs={"url": "nf://templates/base.j2"},
)
print(result)
finally:
nf.destroy()
Filesharing File Details Command Shell Reference¤
NorFab shell supports these command options for Filesharing file_details task:
nf# man tree file.details
root
└── file: File sharing service
└── details: Show file details
└── url: File location, default 'nf://'
nf#
Python API Reference¤
Get file details including md5 hash, size, and existence.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
URL path starting with 'nf://' to get file details |
required |
Returns:
| Type | Description |
|---|---|
Result
|
Result containing md5hash, size_bytes, and exists fields |
Source code in norfab\workers\filesharing_worker\filesharing_worker.py
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | |