Get remote bucket location.
Set remote bucket location.
Get the file content type.
Get the file directory _name.
Get remote ETag
Set remote ETag
Get the file extension.
Get the file object.
Get the ID.
Check if job is locally available.
Get remote key
Set remote key.
Set if the job is locally available.
Get the file _name.
Set a new file _name.
Get the file _name proper.
Get the file _path.
Set a new file _path.
Create a new life event.
Sends an email.
Email options
// my_tunnel.js
tunnel.run(function (job, nest) {
job.email({
subject: "Test email from pug template",
to: "john.smith@example.com",
template: __dirname + "./template_files/my_email.pug"
});
});
// template_files/my_email.pug
h1="Example email!"
p="Got job ID " + job.getId()
tunnel.run(function (job, nest) {
job.email({
subject: "Test email with hard-coded plain-text",
to: "john.smith@example.com",
text: "My email body!"
});
});
tunnel.run(function (job, nest) {
job.email({
subject: "Test email with hard-coded html",
to: "john.smith@example.com",
html: "<h1>My email body!</h1>"
});
});
Function to call to fail a job while in a tunnel.
Get the job object as JSON with circular references removed.
Get the entire job property object.
Get the type of a property.
job.setPropertyValue("My Job Number", 123456);
console.log(job.getPropertyType("My Job Number"));
// "number"
Get the value of a property if it has been previously set.
Check if job is a file.
Check if job is a folder.
Add a message to the log with this job as the actor.
0 = debug, 1 = info, 2, = warning, 3 = error
Log message
Moves a file to a nest. This is an asynchronous method which provides a callback on completion.
The nest object the job will be sent to.
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.
tunnel.run((job, nest) => {
console.log("Found job " + job.name);
job.move(my_s3_bucket, (s3_job) => {
// Uploaded
console.log("Uploaded to " + s3_job.path); // https://mybucket.s3.amazonaws.com/myfile.pdf
});
});
Packs the job instance and file together in a zip. Returns a PackJob in the parameter of the callback.
job.pack(function(packJob){
packJob.move(packed_folder_nest);
});
Deletes the local file.
Rename the job file to a new _name.
Attach job specific data to the job instance.
job.setPropertyValue("My Job Number", 123456);
console.log(job.getPropertyValue("My Job Number"));
// 123456
Class _name for logging.
Transfer a job to another tunnel directly.
Unpacks a packed job. Returns a the original unpacked job in the parameter of the callback.
packedJob.unpack(function(unpackedJob){
console.log("Unpacked", unpackedJob.name);
unpackedJob.move(unpacked_folder);
packedJob.remove();
});
Generated using TypeDoc
Get the file _basename.