puter.perms.requestReadVideos()Request read access to the user's Videos folder. If the user has already granted this permission the user will not be prompted and the path will be returned. If the user grants permission the path will be returned. If the user does not allow access undefined will be returned.
puter.perms.requestReadVideos()
None
A Promise that resolves to:
string - The Videos folder path if permission is grantedundefined - If permission is denied<html>
<body>
<script src="https://js.puter.com/v2/"></script>
<button id="request-videos">Request Videos Read Access</button>
<script>
document.getElementById('request-videos').addEventListener('click', async () => {
const videosPath = await puter.perms.requestReadVideos();
if (videosPath) {
puter.print(`Videos path: ${videosPath}`);
// Now you can read files from the Videos folder
const items = await puter.fs.readdir(videosPath);
puter.print(`Videos contains ${items.length} items`);
} else {
puter.print('Videos read access denied');
}
});
</script>
</body>
</html>