@bytetrade/files-core
v0.1.3
Published
Files API types, transport, and browse session — framework-free
Readme
@bytetrade/files-core
Framework-free files API: types, transport, path helpers, browse session, and (optionally) the HTTP drive adapters. No Vue, Pinia, or Quasar.
Entries
| Import | Contents |
| --- | --- |
| @bytetrade/files-core | Full surface, including drive adapters |
| @bytetrade/files-core/base | Types, config, session, paths, i18n — no HTTP drives. Prefer this when the host supplies its own FilesBrowserClient (the folder picker does). |
Configure
import {
configureFiles,
setFilesLocale,
setFilesI18n
} from '@bytetrade/files-core/base';
configureFiles({
baseURL: 'https://…',
token: () => getAccessToken(),
transport: myAxiosLikeTransport,
browser: myFilesBrowserClient
});
setFilesLocale('zh-CN');
// Optional: forward to the host app's i18n so every language is covered.
setFilesI18n((key, params) => i18n.t(key, params));Built-in i18n
Without setFilesI18n, only English and Chinese catalogs ship in src/i18n.ts. Hosts that support more locales must inject a translator.
FilesBrowserClient
Hosts that drive the UI (folder picker, custom browser) implement FilesBrowserClient and pass it via configureFiles({ browser }). The session (BrowseSession / getBrowseSession(id)) is the navigation authority the UI subscribes to; the client is how the UI asks the host to load menus, open paths, create directories, and go back/forward.
Build
Run these from the repository root so the workspace links resolve:
npm install
npm run build --workspace @bytetrade/files-core
npm test --workspace @bytetrade/files-coreOutput lands in assets/ (gitignored / regenerated). Publishing rebuilds it
through the package's prepack hook.
