Skip to main content
OneDriveResource exposes one Microsoft Graph drive as a read-write filesystem. It uses the same browser-safe core in the Node and browser packages.
Use @struktoai/mirage-browser for the same API in a browser. An access-token callback is recommended so a 401 can refresh the token and retry once. driveId, siteId, groupId and userId are four ways of saying which drive the mount is, so set at most one: setting two throws at construction rather than silently addressing whichever came first. Setting none means /me/drive, which is the only form an app-only token cannot use. Mounts address https://graph.microsoft.com/v1.0 unless graphBaseUrl says otherwise. Set it to reach anything else: a sovereign cloud, a private endpoint, or a test server, given in full including the version segment. The sovereign deployments are network-isolated instances rather than regions, so a token minted for one is rejected by the others and a mount pointed at the wrong root fails outright. mirage ships no table of their hostnames, having no way to verify one; take the root from Microsoft’s national cloud documentation for your tenant. Reads, writes, resumable uploads, recursive copy, move, delete, directory creation, and version-pinned snapshot reads mirror the Python OneDrive resource.