// Create a directory
Storage::disk('onedrive')->createDirectory('Documents/NewFolder');
// List files
$files = Storage::disk('onedrive')->files('Documents');
// List files recursively
$allFiles = Storage::disk('onedrive')->allFiles('Documents');
// List directories
$directories = Storage::disk('onedrive')->directories('Documents');
// Delete a directory and its contents
Storage::disk('onedrive')->deleteDirectory('Documents/OldFolder');
/**
* Microsoft Graph's simple "PUT .../content" endpoint only supports
* files up to 4 MiB. Anything larger MUST go through an upload session.
*
* @see https://learn.microsoft.com/en-us/graph/api/driveitem-put-content
*/
private const SIMPLE_UPLOAD_MAX_BYTES = 4 * 1024 * 1024;
/**
* Each upload-session fragment (except the last) must be a multiple of
* 320 KiB, and the docs warn you may be throttled above 60 MiB per
* request. 10 MiB is a safe multiple of 320 KiB well under that ceiling.
*
* @see https://learn.microsoft.com/en-us/graph/api/driveitem-createuploadsession
*/
private const CHUNK_SIZE = 10 * 1024 * 1024;