UNPKG

pocketbase-tools

Version:

A TypeScript toolkit for PocketBase, featuring a standard service/action/types layered structure. It provides interfaces and implementations for common business logic such as users, products, company profiles, and file utilities, making it suitable for se

17 lines (16 loc) 515 B
import pb from "../base"; export const useFiles = { /** * 获取指定 collection 下文件的下载 URL 和授权 Token * @param collection RecordModel 记录 * @param fileName 文件名 * @returns [url, token] */ async getCollectionURL(collection, fileName) { // 获取当前用户的 token const token = await pb.files.getToken(); // 拼接文件下载 URL const url = pb.files.getURL(collection, fileName); return [url, token]; }, };