Auto-héberger n8n ? Envisagez d'utiliser l'une de ces options pour importer dans Notion !
Ceci est unFile Managementworkflow d'automatisation du domainecontenant 5 nœuds.Utilise principalement des nœuds comme Code, Compression, HttpRequest, ManualTrigger. Utiliser du code JavaScript pour convertir plusieurs fichiers en Base64
- •Peut nécessiter les informations d'identification d'authentification de l'API cible
Nœuds utilisés (5)
Catégorie
{
"id": "p7W4ZMpMtfFP7HYK",
"meta": {
"instanceId": "8981479cb588889c05b145eaed421551d37a4fff11ab279d3f4744a6577c6002"
},
"name": "Base64 Encode Multiple Binary Files with a Code Node",
"tags": [],
"nodes": [
{
"id": "d5da9ec6-6637-4ffb-ae95-a6a0136ff0bb",
"name": "Lors du clic sur 'Exécuter le workflow'",
"type": "n8n-nodes-base.manualTrigger",
"position": [
0,
272
],
"parameters": {},
"typeVersion": 1
},
{
"id": "254e27aa-3538-428b-99e2-2925e366bf74",
"name": "Télécharger n8n démo site web zip",
"type": "n8n-nodes-base.httpRequest",
"position": [
208,
272
],
"parameters": {
"url": "https://github.com/n8n-io/n8n-demo-website/archive/refs/heads/main.zip",
"options": {
"response": {
"response": {
"responseFormat": "file"
}
}
}
},
"typeVersion": 4.2
},
{
"id": "31f153cd-7689-4477-aa54-a5c19820f77e",
"name": "Dézipper",
"type": "n8n-nodes-base.compression",
"position": [
416,
272
],
"parameters": {},
"typeVersion": 1.1
},
{
"id": "40d696a3-024d-46fb-bf42-2a1262148eca",
"name": "Encoder en base64",
"type": "n8n-nodes-base.code",
"position": [
624,
272
],
"parameters": {
"jsCode": "/**\n * Encodes multiple binary files from an n8n input item into Base64 strings.\n *\n * This code assumes it is running in an n8n \"Code\" or \"Function\" node\n * where 'this' refers to the node's context and 'helpers' are available.\n *\n * @returns {object} An object containing an array of file objects,\n * each with a 'path' and 'data' (Base64 string).\n */\nconst results = [];\n\n// The 'async' keyword is required for the outer function to use 'await'.\n// It is assumed the surrounding function is already declared as 'async'.\nfor (const file in $input.first().binary) {\n try {\n // Retrieve the binary object for the current file key.\n const bin = $input.first().binary[file];\n\n // Use n8n's helper function to get the file buffer.\n const binBuffer = await this.helpers.getBinaryDataBuffer(0, file);\n\n // Construct the file path, handling cases with or without a directory.\n const path = bin.directory\n ? `${bin.directory}/${bin.fileName}`\n : bin.fileName;\n\n // Push a new object to the results array.\n results.push({\n path: path,\n data: Buffer.from(binBuffer).toString('base64'),\n });\n } catch (error) {\n // Log any errors that occur during processing.\n console.error(`Error processing file \"${file}\": ${error.message}`);\n // You could also choose to throw the error or handle it differently here.\n }\n}\n\n// Return the final object in the expected format for the next node.\nreturn { files: results };\n"
},
"typeVersion": 2
},
{
"id": "639311dd-9ae7-42c7-aa33-cfdedf9922a8",
"name": "Note adhésive",
"type": "n8n-nodes-base.stickyNote",
"position": [
0,
-160
],
"parameters": {
"width": 720,
"height": 384,
"content": "## Base64 Encode Multiple Binary Files with a Code Node\nThis template demonstrates how to handle multiple binary files in n8n by using a Code node to convert them into a Base64 encoded string. It's particularly useful when an API requires file uploads in this format and the standard 'Extract From File' node is not sufficient for batch processing. The workflow starts by downloading a ZIP file, unzipping it to get multiple binary files, and then uses a Code node with custom JavaScript to encode each file individually.\n### Instructions\n1. Download and import this template into your n8n instance.\n2. Run the workflow once to see how it downloads, unzips, and then encodes multiple files.\n3. Modify the 'HTTP Request' node to download your own binary file or a ZIP file containing multiple files.\n4. Update the 'Code' node if you need to adjust the output format or file paths.\n5. Use the output of the 'Code' node in a subsequent node, such as another 'HTTP Request' to send the Base64-encoded files to your desired API.\n\nA link to the full blog post is available [here](https://n8n-tips.blogspot.com/2025/08/from-binary-to-base64-guide-to-file.html)"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "785dadc6-7b0e-4baf-888f-5dd068d4689d",
"connections": {
"31f153cd-7689-4477-aa54-a5c19820f77e": {
"main": [
[
{
"node": "40d696a3-024d-46fb-bf42-2a1262148eca",
"type": "main",
"index": 0
}
]
]
},
"254e27aa-3538-428b-99e2-2925e366bf74": {
"main": [
[
{
"node": "31f153cd-7689-4477-aa54-a5c19820f77e",
"type": "main",
"index": 0
}
]
]
},
"d5da9ec6-6637-4ffb-ae95-a6a0136ff0bb": {
"main": [
[
{
"node": "254e27aa-3538-428b-99e2-2925e366bf74",
"type": "main",
"index": 0
}
]
]
}
}
}Comment utiliser ce workflow ?
Copiez le code de configuration JSON ci-dessus, créez un nouveau workflow dans votre instance n8n et sélectionnez "Importer depuis le JSON", collez la configuration et modifiez les paramètres d'authentification selon vos besoins.
Dans quelles scénarios ce workflow est-il adapté ?
Débutant - Gestion de fichiers
Est-ce payant ?
Ce workflow est entièrement gratuit et peut être utilisé directement. Veuillez noter que les services tiers utilisés dans le workflow (comme l'API OpenAI) peuvent nécessiter un paiement de votre part.
Workflows recommandés
Viktor Klepikovskyi
@vklepikovskyiPartager ce workflow