Hi
Awesome tool you made!!
I'd like to write a ps1 function that allows me to pipe into wastebin and then get the url-->
cat "Hello World!" | pasteToWaste
I tried this approach, but cannot really get anything to work, have you got an idea?
function pasteToWaste {
if ($args.Count -eq 0) {
Write-Error "No file path specified."
return
}
$FilePath = $args[0]
if (Test-Path $FilePath) {
$Content = Get-Content $FilePath -Raw
} else {
Write-Error "File path does not exist."
return
}
$uri = "http://bin.mydomain.tld"
try {
$response = Invoke-RestMethod -Uri $uri -Method Post -Body @{text=$Content} -ErrorAction Stop
$url = "http://bin.mydomain.tld/$($response.key)"
Write-Output $url
} catch {
Write-Error "Failed to upload the document. Error: $_"
}
}
Hi
Awesome tool you made!!
I'd like to write a ps1 function that allows me to pipe into wastebin and then get the url-->
cat "Hello World!" | pasteToWasteI tried this approach, but cannot really get anything to work, have you got an idea?