App


The App object containing Puter app details.

Attributes

uid (String)

A string containing the unique identifier of the app. This is a unique identifier generated by Puter when the app is created.

name (String)

A string containing the name of the app.

icon (String)

A string containing the Data URL of the icon of the app. This is a base64 encoded image.

description (String)

A string containing the description of the app.

title (String)

A string containing the title of the app.

maximize_on_start (Boolean) (default: false)

A boolean value indicating whether the app should be maximized when it is started.

index_url (String)

A string containing the URL of the index file of the app. This is the file that will be loaded when the app is started.

created_at (String)

A string containing the date and time when the app was created. The format of the date and time is YYYY-MM-DDTHH:MM:SSZ.

background (Boolean) (default: false)

A boolean value indicating whether the app should run in the background. If this is set to true.

filetype_associations (Array)

An array of strings containing the file types that the app can open. Each string should be in the format ".<extension>" or "mime/type". e.g. [".txt", "image/png"]. For a directory association, the string should be .directory.

open_count (Number)

A number containing the number of times the app has been opened. If the stats_period option is set to a value other than all, this will be the number of times the app has been opened in that period.

user_count (Number)

A number containing the number of users that have access to the app. If the stats_period option is set to a value other than all, this will be the number of users that have access to the app in that period.

metadata (Object)

An object containing custom metadata for the app. This can be used to store arbitrary key-value pairs associated with the app.

Methods

users()

Iterates over all users of the apps.

Syntax

app.users()

Parameters

None.

Return value

Iterable objects each containing {username, user_uuid}.

Example

<html>
<body>
    <script src="https://js.puter.com/v2/"></script>
    <script>
        (async () => {
            const app = (await puter.apps.get("stampy"));
            for await (const user of app.users()) {
                console.log(user)
            }
        })();
    </script>
</body>
</html>

getUsers()

Retrieves list of users one page at a time as defined by limit and offset.

Syntax

app.getUsers({ limit, offset })

Parameters

  • limit (Number) (optional): The number of users to retrieve. Default is 100.
  • offset (Number) (optional): The offset to start retrieving users from. Default is 0.

Return value

An array of objects each containing {username, user_uuid}.

Example

<html>
<body>
    <script src="https://js.puter.com/v2/"></script>
    <script>
        (async () => {
            const app = await puter.apps.get("your-app-name");
            const users = await app.getUsers({limit: 2, offset: 0});
            console.log(users);
        })();
    </script>
</body>
</html>