wasm

package
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 23, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Rendered for js/wasm

Overview

Package wasm exposes a cling-sync repository to JavaScript.

Index

Constants

View Source
const MaxDownloadSize = 500 * 1024 * 1024

Variables

This section is empty.

Functions

func Async

func Async(fn func(resolve func(js.Value), reject func(js.Value))) js.Value

Wrap a function in a JS Promise.

func Await

func Await(promise js.Value) (js.Value, error)

Await blocks until the JS Promise resolves or rejects.

func BuildRepositoryAPI

func BuildRepositoryAPI() js.Value

Types

type FetchError

type FetchError struct {
	Message string
}

func (FetchError) Error

func (e FetchError) Error() string

type PromiseError

type PromiseError struct {
	Message string
}

func (PromiseError) Error

func (e PromiseError) Error() string

type RepositoryAPI

type RepositoryAPI struct{}

func (RepositoryAPI) Close

func (r RepositoryAPI) Close(this js.Value, args []js.Value) any

Close wipes the repository's key material and drops the handle. The handle must not be used afterwards.

Parameters:

handle: RepositoryHandle

Returns:

Promise<void>

func (RepositoryAPI) Head

func (r RepositoryAPI) Head(this js.Value, args []js.Value) any

Parameters:

handle: RepositoryHandle

Returns:

Promise<string>

func (RepositoryAPI) Ls

func (r RepositoryAPI) Ls(this js.Value, args []js.Value) any

Parameters:

handle: RepositoryHandle
excludes: string (comma separated)

Returns:

Promise<string>: The result as <tr> elements.

func (RepositoryAPI) Open

func (r RepositoryAPI) Open(this js.Value, args []js.Value) any

Parameters:

url: string
passphrase: string

Returns:

Promise<int> (RepositoryHandle)

func (RepositoryAPI) ReadFile

func (r RepositoryAPI) ReadFile(this js.Value, args []js.Value) any

Read a file from the repository and returns it as a JS `Uint8Array`.

Parameters:

handle: RepositoryHandle
path: string (base64 encoded)
revisionId: string ("" for HEAD)

Returns:

Promise<[Uint8Array, string]>
The data and the file name.

type WasmHTTPClient

type WasmHTTPClient struct{}

A HTTP client that uses the browser's built-in fetch API.

func (*WasmHTTPClient) Request

func (c *WasmHTTPClient) Request(
	ctx context.Context,
	method, url string,
	headers map[string]string,
	body, dst []byte,
) (int, []byte, error)

Directories

Path Synopsis
internal
checkhttp command
checkrepo command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL