First upload version 0.0.1
This commit is contained in:
3
node_modules/ipull/dist/cli/utils/find-download-dir.d.ts
generated
vendored
Normal file
3
node_modules/ipull/dist/cli/utils/find-download-dir.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export default function findDownloadDir(fileName?: string): Promise<string>;
|
||||
export declare function findFileName(url: string): string;
|
||||
export declare function downloadToDirectory(path: string): Promise<boolean>;
|
||||
27
node_modules/ipull/dist/cli/utils/find-download-dir.js
generated
vendored
Normal file
27
node_modules/ipull/dist/cli/utils/find-download-dir.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import path from "path";
|
||||
import fs from "fs-extra";
|
||||
import { AppDB } from "../../settings/settings.js";
|
||||
const DEFAULT_DOWNLOAD_DIR = process.cwd();
|
||||
export default async function findDownloadDir(fileName) {
|
||||
const downloadLocation = AppDB.data[path.extname(fileName || "")];
|
||||
const defaultLocation = AppDB.data["default"];
|
||||
return downloadLocation || defaultLocation || DEFAULT_DOWNLOAD_DIR;
|
||||
}
|
||||
export function findFileName(url) {
|
||||
try {
|
||||
return path.basename(new URL(url).pathname);
|
||||
}
|
||||
catch {
|
||||
return path.basename(url);
|
||||
}
|
||||
}
|
||||
export async function downloadToDirectory(path) {
|
||||
try {
|
||||
const stats = await fs.lstat(path);
|
||||
return stats.isDirectory();
|
||||
}
|
||||
catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=find-download-dir.js.map
|
||||
1
node_modules/ipull/dist/cli/utils/find-download-dir.js.map
generated
vendored
Normal file
1
node_modules/ipull/dist/cli/utils/find-download-dir.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"find-download-dir.js","sourceRoot":"","sources":["../../../src/cli/utils/find-download-dir.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,EAAC,KAAK,EAAC,MAAM,4BAA4B,CAAC;AAEjD,MAAM,oBAAoB,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;AAE3C,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,eAAe,CAAC,QAAiB;IAC3D,MAAM,gBAAgB,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,CAAC;IAClE,MAAM,eAAe,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC9C,OAAO,gBAAgB,IAAI,eAAe,IAAI,oBAAoB,CAAC;AACvE,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,GAAW;IACpC,IAAI,CAAC;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC;IAChD,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,IAAY;IAClD,IAAI,CAAC;QACD,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACnC,OAAO,KAAK,CAAC,WAAW,EAAE,CAAC;IAC/B,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,KAAK,CAAC;IACjB,CAAC;AACL,CAAC"}
|
||||
Reference in New Issue
Block a user