Documentation
¶
Index ¶
Constants ¶
const ( // TransferBaseURL is the base URL of transfer.sh using https. TransferBaseURL string = "https://transfer.sh" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TransferSh ¶
type TransferSh struct {
// contains filtered or unexported fields
}
TransferSh holds configuration for a transfer.sh action.
func NewTransferSh ¶
func NewTransferSh() *TransferSh
NewTransferSh returns an instance of a TransferSh config with appropriate default value for the context. Specifically, the file name is set to authorized_keys with a max of 10 downloads and a life of 2 days.
func (TransferSh) Upload ¶
func (tsh TransferSh) Upload(data string) (*TransferShFile, error)
Upload creates a new file with the contents of data and uploads it to transfer.sh. Returned are the URLs to both download/curl the file and to delete the file form transfer.sh. If the upload fails, an error is returned.
func (TransferSh) WithFilename ¶
func (tsh TransferSh) WithFilename(filename string) TransferSh
WithFilename can be used to modify the filename of a Transfer.sh upload.
func (TransferSh) WithMaxDays ¶
func (tsh TransferSh) WithMaxDays(maxDays int) TransferSh
WithMaxDays can be used to modify the maximum days a transfer.sh upload is visible for.
func (TransferSh) WithMaxDownloads ¶
func (tsh TransferSh) WithMaxDownloads(maxDownloads int) TransferSh
WithMaxDownloads can be used to modify the maximum downloads for a transfer.sh upload.
type TransferShFile ¶
type TransferShFile struct {
// contains filtered or unexported fields
}
TransferShFile is information pertaining to a file uploaded to transfer.sh, including the download URL and the deletion token.
func NewFile ¶ added in v1.1.0
func NewFile(downloadURL, deleteToken string) *TransferShFile
func (TransferShFile) Delete ¶ added in v1.1.0
func (tshFile TransferShFile) Delete() error
Delete attempts to delete the file from transfer.sh using the file's download link and delete token. If an error is returned this may indicate that the file has already been deleted or that the request to delete was simply not successful.
func (TransferShFile) DeleteToken ¶
func (tshFile TransferShFile) DeleteToken() string
DeleteToken is the token required to delete the upload file prior to its normal expiration.
func (TransferShFile) DownloadURL ¶
func (tshFile TransferShFile) DownloadURL() string
DownloadURL is the full URL that can be used to download the contents of a file uploaded to the https://transfer.sh file store.