1 | import { Environment } from "../environment/environment";
|
2 | import { Job } from "./job";
|
3 | import { File } from "./file";
|
4 | export declare class FileJob extends Job {
|
5 | protected file: File;
|
6 | /**
|
7 | * FileJob constructor.
|
8 | * @param e
|
9 | * @param path
|
10 | */
|
11 | constructor(e: Environment, path: string);
|
12 | /**
|
13 | * Get the file object.
|
14 | * @returns {File}
|
15 | */
|
16 | getFile(): File;
|
17 | /**
|
18 | * Get the file name.
|
19 | * @returns {string}
|
20 | */
|
21 | getName(): string;
|
22 | /**
|
23 | * Get the file name proper.
|
24 | * @returns {string}
|
25 | */
|
26 | getNameProper(): any;
|
27 | /**
|
28 | * Get the file directory name.
|
29 | * @returns {string}
|
30 | */
|
31 | getDirname(): string;
|
32 | /**
|
33 | * Get the file path.
|
34 | * @returns {string}
|
35 | */
|
36 | getPath(): string;
|
37 | /**
|
38 | * Set a new file path.
|
39 | * @param path
|
40 | */
|
41 | setPath(path: string): void;
|
42 | /**
|
43 | * Set a new file name.
|
44 | * @param filename
|
45 | */
|
46 | setName(filename: string): void;
|
47 | /**
|
48 | * Get the file content type.
|
49 | * @returns {string}
|
50 | */
|
51 | getContentType(): string;
|
52 | /**
|
53 | * Get the file extension.
|
54 | * @returns {string}
|
55 | */
|
56 | getExtension(): string;
|
57 | /**
|
58 | * Get the file basename.
|
59 | * @returns {string}
|
60 | */
|
61 | getBasename(): string;
|
62 | /**
|
63 | * Check if job is a folder.
|
64 | * @returns {boolean}
|
65 | */
|
66 | isFolder(): boolean;
|
67 | /**
|
68 | * Check if job is a file.
|
69 | * @returns {boolean}
|
70 | */
|
71 | isFile(): boolean;
|
72 | /**
|
73 | * Moves a file to a nest. This is an asynchronous method which provides a callback on completion.
|
74 | * @param destinationNest The nest object the job will be sent to.
|
75 | * @param callback The callback provides the updated instance of the job. Depending on the nest it was sent to, it may have been cast to a new job type. This is helpful in case you need the remote path to the job once it has been uploaded to S3, for example.
|
76 | * #### Example
|
77 | * ```js
|
78 | * tunnel.run((job, nest) => {
|
79 | * console.log("Found job " + job.getName());
|
80 | * job.move(my_s3_bucket, (s3_job) => {
|
81 | * // Uploaded
|
82 | * console.log("Uploaded to " + s3_job.getPath());
|
83 | * });
|
84 | * });
|
85 | * ```
|
86 | */
|
87 | move(destinationNest: any, callback: any): void;
|
88 | /**
|
89 | * Rename the job file to a new name.
|
90 | * @param newName
|
91 | */
|
92 | rename(newName: string): void;
|
93 | }
|