| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
tempf is a lightweight HTTP server designed for temporary file storage. It allows users to easily upload files via simple curl commands. The application includes built-in API key authorization, which lets you control file access—files can either be publicly accessible or password-protected for secure downloads.
tempf supports setting expiration dates for files, automatically deleting them once their lifespan expires. You can create and organize nested folders, as well as delete files and folders individually or in bulk using patterns with * and ?. Access to file and folder lists can be fully public or restricted based on path patterns, which can be configured through application flags.
-path (string): Specifies the configuration folder. If left empty, it defaults to the folder where the application is running.
-disable (string): Disables specific handlers. Provide a list of handler names separated by commas.
-resetkey (bool): Resets the API key used for file upload authorization.
-maxuploadsize (int64): Sets the maximum upload size in bytes. A value of 0 means no limit.
-maxmemstore (int64): Defines the maximum file size (in bytes) to be stored in memory rather than the database. A value of 0 means the file is never stored in the database.
-run (bool): Starts the server.
-allowlist (slice): A pattern-based allowlist (using * and ?) to control which files can be listed publicly in the absence of authorization.
tempf -path /etc/tempf -disable upload,delete -maxuploadsize 20971520 -runThe tempf server allows users to upload files using curl. Files can be uploaded with optional parameters such as file expiration time, custom comments, and password protection via the hash parameter.
curl -v -X POST -H "Authorization: Bearer <API_KEY>" \
-F "file=@/path/to/file.txt" \
"http://<server_address>/upload/yourfilename?expire=1day&hash=yourpassword&comment=TestFileUpload"curl -v -X POST -H "Authorization: Bearer myapikey123" \
-F "file=@/home/user/test.txt" \
"http://localhost:8080/upload/testfile?expire=1week&hash=securepassword&comment=ImportantUpload"The List method in the tempf server is used to retrieve a list of files and folders that match a specific pattern. It supports wildcard characters (* for multiple characters and ? for a single character) for flexible file and folder matching. Access to the file list is secured by an API key and can be restricted based on path patterns.
GET /list/{path}
path: (required) The folder path or filename to list. Can contain wildcards (* and ?).
include: (optional) Filters to include specific file types:
limit: (optional) Limits the number of results returned.
curl -X GET -H "Authorization: Bearer <API_KEY>" \
"http://<server_address>/list/john/invoices?include=file&limit=10"[
{
"key": "john/invoices/2024/07/invoice1.pdf",
"fileInfo": {
"size": 102400,
"lastModified": "2024-07-01T12:00:00Z",
"type": "file"
}
},
{
"key": "john/invoices/2024/07/invoice2.pdf",
"fileInfo": {
"size": 204800,
"lastModified": "2024-07-01T12:30:00Z",
"type": "file"
}
}
]The Upload method in the tempf server allows users to upload files with optional parameters such as expiration, comments, and password protection (via a hash). Access is secured using an API key.
POST /upload/{filename_with_path}
filename_with_path: (required) The name and path where the file should be saved on the server.
name: (optional) Original name of the file being uploaded.
comment: (optional) A comment or description to attach to the uploaded file.
expire: (optional) The expiration time for the file. Use a numerical value followed by year, month, week, day, hour, minute, or second.
hash: (optional) A password to protect the file from public access.
curl -v -X POST -H "Authorization: Bearer <API_KEY>" \
-F "file=@/path/to/file.txt" \
"http://<server_address>/upload/myfile?name=myfile.txt&expire=1day&hash=securepassword&comment=ImportantFile"If values are provided both in the URL and the headers, the header values take precedence.
{
"message": "file uploaded successfully",
"file_key": "docs/myfile.txt",
"size": 102400,
"expire_after": "1day"
}In this example, the file myfile.txt is uploaded, with an expiration time of 1 day and password protection.
The Download method in the tempf server allows users to download files. The method supports optional password protection via a hash, which must be provided if the file was protected during upload. Access is secured by an API key or by the file's hash if it was set.
GET /download/{filename_with_path}
filename_with_path: (required) The path and filename of the file to download.
hash: (optional) If the file was protected by a hash during upload, you must provide the correct hash.
curl -X GET -H "Authorization: Bearer <API_KEY>" \
"http://<server_address>/download/docs/myfile.txt?hash=securepassword"If both the hash is provided in the URL and in the headers, the header value takes precedence.
The Remove method in the tempf server is used to delete a single file from the server. This method requires bearer token authorization for security. It only removes individual files, not directories. If you want to delete an entire directory, use the RemoveAll method.
GET /remove/{filename_with_path}
curl -X GET -H "Authorization: Bearer <API_KEY>" \
"http://<server_address>/remove/docs/myfile.txt"The RemoveAll method in the tempf server is used to recursively delete a directory, including all subdirectories and files within it. This method requires bearer token authorization for security and supports wildcards (* and ?) to match specific files or folders.
GET /removeall/{directory_with_path}/
curl -X GET -H "Authorization: Bearer <API_KEY>" \
"http://<server_address>/removeall/docs/old_files/*"| Back | FazBrowse Home | New Git URL |