n8nはセルフホストする?以下のいずれかを使ってNotionにアップロードを検討!
初級
これはFile Management分野の自動化ワークフローで、5個のノードを含みます。主にCode, Compression, HttpRequest, ManualTriggerなどのノードを使用。 複数のファイルをJavaScriptコードでBase64に変換する
前提条件
- •ターゲットAPIの認証情報が必要な場合あり
カテゴリー
ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
"id": "p7W4ZMpMtfFP7HYK",
"meta": {
"instanceId": "8981479cb588889c05b145eaed421551d37a4fff11ab279d3f4744a6577c6002"
},
"name": "Base64 Encode Multiple Binary Files with a Code Node",
"tags": [],
"nodes": [
{
"id": "d5da9ec6-6637-4ffb-ae95-a6a0136ff0bb",
"name": "「ワークフローを実行」クリック時",
"type": "n8n-nodes-base.manualTrigger",
"position": [
0,
272
],
"parameters": {},
"typeVersion": 1
},
{
"id": "254e27aa-3538-428b-99e2-2925e366bf74",
"name": "n8n デモ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": "解凍",
"type": "n8n-nodes-base.compression",
"position": [
416,
272
],
"parameters": {},
"typeVersion": 1.1
},
{
"id": "40d696a3-024d-46fb-bf42-2a1262148eca",
"name": "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": "付箋",
"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
}
]
]
}
}
}よくある質問
このワークフローの使い方は?
上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。
このワークフローはどんな場面に適していますか?
初級 - ファイル管理
有料ですか?
このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。
関連ワークフロー
コードなし:複数のバイナリファイルをBase64に変換
カスタムコードなしで複数のバイナリファイルをBase64 JSON配列に変換する
Set
Split Out
Aggregate
+
Set
Split Out
Aggregate
8 ノードViktor Klepikovskyi
JSONフォルダ分離
Google スプレッドシートからバッチで JSON ファイルをローカルフォルダにダウンロード
Code
Http Request
Google Sheets
+
Code
Http Request
Google Sheets
16 ノードRahul Joshi
ファイル管理
サブワークフローのネストされたループ
n8nのサブワークフローを使ってネストされたデータ処理ループを作成
Set
Code
Manual Trigger
+
Set
Code
Manual Trigger
9 ノードViktor Klepikovskyi
エンジニアリング
Reddit の絵文字を自動のに Google Drive にダウンロードし、重複検出と Telegram メッセージで通知
Reddit からのスタンプを自動のに Google Drive にダウンロードし、重複検出と Telegram アラートを含める
If
Set
Code
+
If
Set
Code
20 ノードVitorio Magalhães
ファイル管理
Zoom の録画を Google ドライブに保存し、Airtable にメーティング記録を加える
Zoom 録画を Google ドライブに自動保存し、Airtable でメッセージを記録
Code
Webhook
Airtable
+
Code
Webhook
Airtable
7 ノードDavid Olusola
ファイル管理
Google Driveで保存し、TelegramでリマインドしてInstagram Reelをダウンロードを自動化
Google Drive の保存と Telegram によるリマインダーで Instagram Reel ダウンロードを自動化
If
Code
Webhook
+
If
Code
Webhook
11 ノードAryan Shinde
ファイル管理