puter.fs.getReadURL()

Websites Puter Apps Node.js Workers

Generates a URL that can be used to read a file.

Syntax

puter.fs.getReadURL(path)
puter.fs.getReadURL(path, expiresIn)

Parameters

path (String) (Required)

The path to the file to read.

expiresIn (String | Number) (Optional)

How long the URL stays valid, in jsonwebtoken duration format: a string like '24h', '30d', or '1h' (units: s, m, h, d, w, y), or a number of seconds. If not provided, defaults to '24h'.

Return value

A promise that resolves to a URL string that can be used to read the file.

Example

const url = await puter.fs.getReadURL("~/myfile.txt");