FileCreateAndUpload Deprecated

Deprecated. Use FileCreateAndUploadV2 instead. Will create a file (using the given data input or entry ID) and upload it to current investigation war room.

javascript · Common Scripts

Source

if (!args.data && !args.entryId) {
    return { ContentsFormat: formats.text, Type: entryTypes.error, Contents: 'Either data or entryId arguments need to be provided.' };
}
if (args.data && args.entryId) {
    return { ContentsFormat: formats.text, Type: entryTypes.error, Contents: 'Cannot provide both data and entryId arguments.' };
}

var data = "";
if (args.data) {
    data = args.data;
}
if (args.entryId) {
    var res = executeCommand("getEntry", {"id":args.entryId});
    if (res[0].Type === entryTypes.error) {
        return res;
    }
    data = res[0].Contents;
}
var createdFileID = saveFile(data);
return {Type: 3, FileID: createdFileID, File: args.filename, Contents: args.filename};

README

Creates a file using the given data input or entry ID, and uploads it to the current investigation’s War Room.

Script Data


Name Description
Script Type javascript
Tags Utility

Inputs


Argument Name Description
filename The name of the file to be created.
data The input data to write to file.
entryId The entry ID contents to write into file.

Outputs


There are no outputs for this script.