MCPcopy Create free account
hub / github.com/omkarcloud/botasaurus / getPathToDownloadsDirectory

Function getPathToDownloadsDirectory

js/botasaurus-server-js/src/paths.ts:19–39  ·  view source on GitHub ↗
(filename: string, downloadFolder?: string | null)

Source from the content-addressed store, hash-verified

17
18
19export function getPathToDownloadsDirectory(filename: string, downloadFolder?: string | null): string {
20 let targetPath: string;
21
22 if (downloadFolder && downloadFolder.trim() !== '') {
23 // Use custom download folder
24 targetPath = downloadFolder;
25 targetPath = path.join(targetPath, electronConfig.productName);
26 } else {
27 // Use default downloads path
28 const downloadsPath = electronConfig.downloadsPath;
29 targetPath = path.join(downloadsPath, electronConfig.productName);
30 }
31
32 if (!fs.existsSync(targetPath)) {
33 fs.mkdirSync(targetPath, { recursive: true });
34 }
35
36 const filePath = path.join(targetPath, filename);
37
38 return filePath;
39}
40
41export function getTargetDirectoryPath() {
42 if (isElectron) {

Callers 2

downloadResultsFunction · 0.90
executeDownloadTaskListFunction · 0.90

Calls 1

joinMethod · 0.80

Tested by

no test coverage detected