RecycleBinService

Up and coming: shot check knows this class and its members today, and programs run it once the native runtime lands.

ShotInstanceservicenot creatablecomingFiles

Up and coming

Throw files away without losing them, and get scratch folders that clean up after themselves.

RecycleAsync moves a file or folder into a bin on its own drive, so it is always a rename, never a copy, and each RecycledItem can be restored. A folder from CreateScratchFolderAsync is for files you hand to another program: it belongs to the run and is recycled when the run ends, unless KeepScratch keeps it.

A service: write use RecycleBinService.

Properties

NameTypeDefaultDescription
ScratchRootPathHandlerWhere scratch folders go: a Scratch folder in ProgramService.DataFolder by default; point it at another drive for big files.

Methods

NameArgumentsReturnsDescription
RecycleAsync
yields
(path: PathHandler)(RecycledItem?, string?)Moves the file or folder into the bin on its own drive, so it is always a rename, never a copy.
GetItemsAsync
yields
()({ RecycledItem }?, string?)Every item in the bin, newest first.
EmptyAsync
yields
(olderThanDays: number?)(number?, string?)Deletes items in the bin for good, only those older than olderThanDays when given, and returns how many went.
CreateScratchFolderAsync
yields
(name: string?)(PathHandler?, string?)A new empty folder for files handed to another program; it belongs to the run and is recycled when the run ends unless kept.
KeepScratch(folder: PathHandler)()Keeps that scratch folder after the run, for example to look at a failed export.
From ShotInstance 33