Shell script helper functions for encoding/decoding querystring data.
#!/usr/bin/env import
import "querystring@1.3.0"
querystring_escape "hello world"# hello%20world
querystring_unescape "hello%20world"# hello worldOutputs the querystring portion of the provided request URL. Once you have the
querystring, it may be parsed with querystring_parse.
#!/usr/bin/env import
import "querystring@1.3.0"
querystring "/api/hello"# (empty)
querystring "/api/hello?name=rick"# name=rickEncodes the input with querystring percent-encoding.
Similar to encodeURIComponent() in JavaScript.
#!/usr/bin/env import
import "querystring@1.3.0"
querystring_escape hello world
# hello%20world# Also works over stdinecho hello world | querystring_escape
# hello%20worldDecodes querystring-encoded content.
Similar to decodeURIComponent() in JavaScript.
#!/usr/bin/env import
import "querystring@1.3.0"
querystring_unescape "hello%20world"# hello worldParses the provided qs querystring and sets the requested shell variables.
#!/usr/bin/env import
import "querystring@1.3.0"
querystring_parse "one=1&two=2&three=3" one two
echo"$one"# 1echo"$two"# 2echo"$three"# Not set, since it was not requested in `querystring_parse`