How to modify filename when obtaining file from http?
1 Like
Hey @CometNet,
You can rename the file name using the Function Node as shown in the example workflow below:
Note: I am updating the configuring the file name in the first line of the code in the Function node. Also, this will work only if you’re receiving a single file. For multiple files you’ll have to tweak the function.
2 Likes
for (index in items){
items[index].binary.data = Object.assign(items[index].binary.data, {fileName:"new filename"});
}
return items;
Thank you
3 Likes
for (index in items){
items[index].binary.data = Object.assign(items[index].binary.data, {fileName:"new filename"});
}
return items;
This is so useful, it should be more prominent imho.
2 Likes
You can use this Code snippet (for every item)
$input.item.binary.data = Object.assign($input.item.binary.data, {fileName: $input.item.binary.data.fileName + ".ogg"});
return $input.item;
1 Like