magus v0.4.2 is out. See what's new
¶ View generated markdown
1 min read

url

URL percent-encoding, parsing, and building.

Naming convention: import the module under its bare name (import "url"), reach members with a backslash, and call methods in camelCase: url\someMethod.

Methods

encode

Percent-encode s for use in a URL query component.

Signature: url\encode(s) -> string - source

Parameter Type Optional Description
s string

Returns: string

decode

Decode a percent-encoded URL query component; errors on malformed input.

Signature: url\decode(s) -> string - source

Parameter Type Optional Description
s string

Returns: string

parse

Parse a URL string into {scheme, host, port, path, query, fragment}; errors on malformed input.

Signature: url\parse(raw_url) -> URL - source

Parameter Type Optional Description
raw_url string

Returns: map[string]any

build

Build a URL string from a URL object - the same shape parse returns, so the two round-trip. Missing fields are treated as empty.

Signature: url\build(parts) -> string - source

Parameter Type Optional Description
parts map[string]any

Returns: string

generatedreference/buzz/urlmodulestdlibmagusfile
Last updated (4f8cc295)
Earlier changes on this page (2)

Full history ↗ · Blame source ↗

Glossary

Magusfile

The magusfile.buzz that declares a project's targets (as export funs) and binds its spells. See targets.

Op

A single tool-native command a target composes (long form: operation); the middle of the work hierarchy (Spell to Op to Target). See operations.

Module

A magus stdlib namespace a magusfile imports for host capabilities: filesystem, exec, vcs, and more. See the module reference.

Buzz

The language magusfiles are written in (the .buzz engine). See engines.

Conventions

This page uses none of the site's convention markers. The full set is on the conventions page.