This repository has been archived by the owner on Oct 25, 2024. It is now read-only.
forked from TheWaWaR/simple-http-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Docs, actual API Usage example, todo bash example
- Loading branch information
Showing
3 changed files
with
48 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
powershell.ps1 | ||
|
||
might need a bit of cleanup, but i'll do later.. because learned rust while making this fork in a way... | ||
``` | ||
function swscli ($filename) | ||
{ | ||
$file = Get-Item $filename; | ||
$fileName = Get-Item $filename | ||
$filetxtname = $($fileName.Name) | ||
$uri = "http://my-simpler-srv.local:8000/" | ||
$currentPath = Convert-Path . | ||
$filePath="$currentPath\$fileName" | ||
$fileBin = Get-Content -Path $fileName.FullName -Raw | ||
$boundary = [System.Guid]::NewGuid().ToString() | ||
$LF = "`r`n" | ||
$bodyLines = ( | ||
"--$boundary", | ||
"Content-Disposition: form-data; name=`"files`"; filename=`"$filetxtname`"; csrf=`"notoken`"", | ||
"Content-Type: application/octet-stream$LF", | ||
$fileBin, | ||
"--$boundary--$LF" | ||
) -join $LF | ||
$headers = @{ | ||
"Content-Type" = "multipart/form-data; boundary=`"$boundary`"" | ||
} | ||
Invoke-RestMethod -Uri $uri -Method POST -Headers $headers -Body $bodyLines | ||
} | ||
function transfersh ($filename) | ||
{ | ||
$file = Get-Item $filename; | ||
(Invoke-WebRequest -Method POST -InFile $file.FullName -Uri http://comapredwith.transfer.sh:8000/$($file.Name)).Content | ||
} | ||
# Example usage | ||
swscli(".\my-automatic-output.csv") | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.