n8n-nodes-binary-to-url 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +388 -55
- package/dist/drivers/S3Storage.d.ts +13 -5
- package/dist/drivers/S3Storage.js +162 -54
- package/dist/drivers/index.d.ts +2 -4
- package/dist/drivers/index.js +1 -17
- package/dist/nodes/BinaryBridge/BinaryBridge.node.js +6 -44
- package/dist/nodes/BinaryBridge/BinaryBridge.node.ts +6 -46
- package/dist/nodes/BinaryBridge/BinaryBridge.svg +96 -4
- package/nodes/BinaryBridge/BinaryBridge.node.ts +6 -46
- package/nodes/BinaryBridge/BinaryBridge.svg +96 -4
- package/package.json +3 -8
- package/dist/drivers/SupabaseStorage.d.ts +0 -26
- package/dist/drivers/SupabaseStorage.js +0 -206
package/README.md
CHANGED
|
@@ -1,89 +1,422 @@
|
|
|
1
|
-
# n8n-nodes-binary-
|
|
1
|
+
# n8n-nodes-binary-to-url
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+
**Binary Bridge - n8n Community Node**
|
|
6
|
+
|
|
7
|
+
Upload binary files to cloud storage and access them via public URLs
|
|
8
|
+
|
|
9
|
+
[](https://www.npmjs.com/package/n8n-nodes-binary-to-url)
|
|
10
|
+
[](https://opensource.org/licenses/MIT)
|
|
11
|
+
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
---
|
|
4
15
|
|
|
5
16
|
## Features
|
|
6
17
|
|
|
7
|
-
- **Upload
|
|
8
|
-
- **
|
|
9
|
-
- **
|
|
10
|
-
- **
|
|
11
|
-
- **
|
|
12
|
-
- **
|
|
13
|
-
|
|
18
|
+
- **Upload to Storage** - Upload binary files to S3 or Supabase storage
|
|
19
|
+
- **Public URL Proxy** - Get public URLs via built-in webhook proxy
|
|
20
|
+
- **Streaming Support** - High-performance streaming to avoid memory overflow
|
|
21
|
+
- **Multiple Storage Backends** - Support for AWS S3, S3-compatible services, and Supabase
|
|
22
|
+
- **File Type Detection** - Automatic MIME type detection with security validation
|
|
23
|
+
- **Flexible Configuration** - Support for custom endpoints and path-style addressing
|
|
24
|
+
|
|
25
|
+
## Table of Contents
|
|
26
|
+
|
|
27
|
+
- [Installation](#installation)
|
|
28
|
+
- [Quick Start](#quick-start)
|
|
29
|
+
- [Configuration](#configuration)
|
|
30
|
+
- [Usage Examples](#usage-examples)
|
|
31
|
+
- [Architecture](#architecture)
|
|
32
|
+
- [API Reference](#api-reference)
|
|
33
|
+
- [Security](#security)
|
|
34
|
+
- [Troubleshooting](#troubleshooting)
|
|
35
|
+
- [Development](#development)
|
|
36
|
+
|
|
37
|
+
---
|
|
14
38
|
|
|
15
39
|
## Installation
|
|
16
40
|
|
|
41
|
+
### Install via npm
|
|
42
|
+
|
|
17
43
|
```bash
|
|
18
|
-
npm install n8n-nodes-binary-
|
|
44
|
+
npm install n8n-nodes-binary-to-url
|
|
19
45
|
```
|
|
20
46
|
|
|
21
|
-
|
|
47
|
+
### Install in n8n
|
|
22
48
|
|
|
23
|
-
|
|
49
|
+
1. Go to your n8n installation directory
|
|
50
|
+
2. Run the npm install command above
|
|
51
|
+
3. Restart n8n
|
|
52
|
+
4. The "Binary Bridge" node will appear in the node palette
|
|
24
53
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
6. (Optional) Enable force path style if needed
|
|
31
|
-
7. Connect a node with binary data to the Binary Bridge node
|
|
32
|
-
8. Execute the workflow
|
|
33
|
-
9. The node will return:
|
|
34
|
-
- `fileKey`: Unique file identifier
|
|
35
|
-
- `proxyUrl`: Public URL to access the file
|
|
36
|
-
- `contentType`: MIME type of the file
|
|
37
|
-
|
|
38
|
-
### Delete Mode
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Quick Start
|
|
57
|
+
|
|
58
|
+
### Basic Upload
|
|
39
59
|
|
|
40
60
|
1. Add a **Binary Bridge** node to your workflow
|
|
41
|
-
2.
|
|
42
|
-
3.
|
|
43
|
-
4.
|
|
44
|
-
5.
|
|
45
|
-
6.
|
|
46
|
-
7.
|
|
47
|
-
|
|
48
|
-
|
|
61
|
+
2. Select **AWS S3** or **Supabase** as storage driver
|
|
62
|
+
3. Configure your credentials
|
|
63
|
+
4. Set operation to **Upload**
|
|
64
|
+
5. Configure bucket name and region
|
|
65
|
+
6. Connect any node with binary data (e.g., HTTP Request, Read Binary File)
|
|
66
|
+
7. Execute the workflow
|
|
67
|
+
|
|
68
|
+
**Output:**
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"fileKey": "1704801234567-abc123def456.jpg",
|
|
73
|
+
"proxyUrl": "https://your-n8n.com/webhook/123/binarybridge/file/1704801234567-abc123def456.jpg",
|
|
74
|
+
"contentType": "image/jpeg",
|
|
75
|
+
"fileSize": 245678
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Configuration
|
|
82
|
+
|
|
83
|
+
### Storage Drivers
|
|
84
|
+
|
|
85
|
+
#### AWS S3 / S3-Compatible
|
|
86
|
+
|
|
87
|
+
| Parameter | Type | Required | Description |
|
|
88
|
+
| --------------------- | ------- | -------- | ---------------------------------------------- |
|
|
89
|
+
| **Access Key ID** | string | ✅ Yes | AWS access key ID |
|
|
90
|
+
| **Secret Access Key** | string | ✅ Yes | AWS secret access key |
|
|
91
|
+
| **Region** | string | ✅ Yes | AWS region (e.g., `us-east-1`) |
|
|
92
|
+
| **Bucket** | string | ✅ Yes | S3 bucket name |
|
|
93
|
+
| **Custom Endpoint** | string | ❌ No | Custom endpoint URL for S3-compatible services |
|
|
94
|
+
| **Force Path Style** | boolean | ❌ No | Use path-style addressing (default: `false`) |
|
|
95
|
+
|
|
96
|
+
**Supported S3-Compatible Services:**
|
|
97
|
+
|
|
98
|
+
- AWS S3
|
|
99
|
+
- Alibaba Cloud OSS
|
|
100
|
+
- Tencent Cloud COS
|
|
101
|
+
- MinIO
|
|
102
|
+
- DigitalOcean Spaces
|
|
103
|
+
- Wasabi
|
|
104
|
+
- Any S3-compatible storage
|
|
105
|
+
|
|
106
|
+
#### Supabase
|
|
107
|
+
|
|
108
|
+
| Parameter | Type | Required | Description |
|
|
109
|
+
| --------------- | ------ | -------- | ---------------------------- |
|
|
110
|
+
| **Project URL** | string | ✅ Yes | Supabase project URL |
|
|
111
|
+
| **API Key** | string | ✅ Yes | Supabase API key |
|
|
112
|
+
| **Bucket** | string | ✅ Yes | Supabase storage bucket name |
|
|
113
|
+
|
|
114
|
+
### Operations
|
|
115
|
+
|
|
116
|
+
#### Upload Operation
|
|
117
|
+
|
|
118
|
+
| Parameter | Type | Required | Default | Description |
|
|
119
|
+
| ------------------- | ------ | -------- | ------- | --------------------------------------- |
|
|
120
|
+
| **Binary Property** | string | ❌ No | `data` | Name of binary property containing file |
|
|
121
|
+
|
|
122
|
+
#### Delete Operation
|
|
123
|
+
|
|
124
|
+
| Parameter | Type | Required | Default | Description |
|
|
125
|
+
| ------------ | ------ | -------- | ------- | ------------------------- |
|
|
126
|
+
| **File Key** | string | ✅ Yes\* | - | Key of the file to delete |
|
|
127
|
+
|
|
128
|
+
\*Can also be provided from previous node via `fileKey` property
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Usage Examples
|
|
133
|
+
|
|
134
|
+
### Example 1: Upload and Share Image
|
|
49
135
|
|
|
50
|
-
|
|
136
|
+
```yaml
|
|
137
|
+
Workflow: 1. HTTP Request (download image)
|
|
138
|
+
2. Binary Bridge (upload to S3)
|
|
139
|
+
3. Send email with image URL
|
|
140
|
+
```
|
|
51
141
|
|
|
52
|
-
|
|
142
|
+
**Output after step 2:**
|
|
53
143
|
|
|
144
|
+
```json
|
|
145
|
+
{
|
|
146
|
+
"proxyUrl": "https://n8n.example.com/webhook/abc123/binarybridge/file/1704801234567-abc.jpg"
|
|
147
|
+
}
|
|
54
148
|
```
|
|
55
|
-
|
|
149
|
+
|
|
150
|
+
### Example 2: Upload Multiple Files
|
|
151
|
+
|
|
152
|
+
```yaml
|
|
153
|
+
Workflow: 1. Read Binary Files (from folder)
|
|
154
|
+
2. Binary Bridge (upload to S3)
|
|
155
|
+
3. Loop over results
|
|
156
|
+
4. Create database record with URLs
|
|
56
157
|
```
|
|
57
158
|
|
|
58
|
-
|
|
159
|
+
### Example 3: Upload and Delete
|
|
160
|
+
|
|
161
|
+
```yaml
|
|
162
|
+
Workflow:
|
|
163
|
+
1. Upload file → Binary Bridge (operation: Upload)
|
|
164
|
+
2. Use URL temporarily
|
|
165
|
+
3. After 24 hours → Binary Bridge (operation: Delete)
|
|
166
|
+
```
|
|
59
167
|
|
|
60
|
-
|
|
61
|
-
- **Content-Type** header with correct MIME type
|
|
62
|
-
- **Cache-Control**: 24-hour cache
|
|
63
|
-
- **Content-Disposition**: inline for browser preview
|
|
168
|
+
---
|
|
64
169
|
|
|
65
170
|
## Architecture
|
|
66
171
|
|
|
67
|
-
|
|
172
|
+
### Single-Node Proxy Pattern
|
|
173
|
+
|
|
174
|
+
This node implements a unique **Single-Node Proxy** architecture:
|
|
175
|
+
|
|
176
|
+
```
|
|
177
|
+
┌─────────────┐ Upload ┌──────────────┐
|
|
178
|
+
│ n8n Node │ ───────────────► │ S3/Supabase │
|
|
179
|
+
│ (Binary │ ◄─────────────── │ Storage │
|
|
180
|
+
│ Bridge) │ Return URL │ │
|
|
181
|
+
└──────┬──────┘ └──────────────┘
|
|
182
|
+
│
|
|
183
|
+
│ GET Request (proxy file)
|
|
184
|
+
▼
|
|
185
|
+
┌─────────────────────────────────┐
|
|
186
|
+
│ Return file stream to client │
|
|
187
|
+
│ - Content-Type header │
|
|
188
|
+
│ - Cache-Control: 24h │
|
|
189
|
+
│ - Content-Disposition: inline │
|
|
190
|
+
└─────────────────────────────────┘
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Key Advantages
|
|
194
|
+
|
|
195
|
+
- **Zero External Dependencies** - No additional services needed
|
|
196
|
+
- **Memory Efficient** - Streaming prevents memory overflow in n8n Cloud
|
|
197
|
+
- **Automatic URL Generation** - Webhook URL auto-generated based on n8n instance
|
|
198
|
+
- **Secure File Keys** - Timestamp + random string prevents guessing
|
|
199
|
+
- **MIME Type Validation** - White-list of allowed file types for security
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## API Reference
|
|
204
|
+
|
|
205
|
+
### Upload Response
|
|
206
|
+
|
|
207
|
+
```typescript
|
|
208
|
+
{
|
|
209
|
+
fileKey: string; // Unique file identifier
|
|
210
|
+
proxyUrl: string; // Public URL to access file
|
|
211
|
+
contentType: string; // MIME type (e.g., "image/jpeg")
|
|
212
|
+
fileSize: number; // File size in bytes
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Delete Response
|
|
217
|
+
|
|
218
|
+
```typescript
|
|
219
|
+
{
|
|
220
|
+
success: boolean; // true if deletion succeeded
|
|
221
|
+
deleted: string; // The file key that was deleted
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Supported File Types
|
|
226
|
+
|
|
227
|
+
**Images:**
|
|
228
|
+
|
|
229
|
+
- JPEG, PNG, GIF, WebP, SVG, BMP, TIFF, AVIF
|
|
230
|
+
|
|
231
|
+
**Videos:**
|
|
232
|
+
|
|
233
|
+
- MP4, WebM, MOV, AVI, MKV
|
|
234
|
+
|
|
235
|
+
**Audio:**
|
|
236
|
+
|
|
237
|
+
- MP3, WAV, OGG, FLAC
|
|
238
|
+
|
|
239
|
+
**Documents:**
|
|
240
|
+
|
|
241
|
+
- PDF, ZIP, RAR, 7Z, TXT, CSV, JSON, XML, XLSX, DOCX
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## Security
|
|
246
|
+
|
|
247
|
+
### File Type Validation
|
|
248
|
+
|
|
249
|
+
Files are validated against a white-list of allowed MIME types. The `file-type` library detects the actual file type from binary signature, not just the file extension.
|
|
250
|
+
|
|
251
|
+
### File Key Format
|
|
68
252
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
-
|
|
72
|
-
|
|
253
|
+
File keys follow the pattern: `{timestamp}-{random}.{extension}`
|
|
254
|
+
|
|
255
|
+
Example: `1704801234567-abc123def456.jpg`
|
|
256
|
+
|
|
257
|
+
This prevents unauthorized file enumeration.
|
|
258
|
+
|
|
259
|
+
### File Size Limits
|
|
260
|
+
|
|
261
|
+
- **Maximum file size:** 100 MB
|
|
262
|
+
- Configurable in source code (`MAX_FILE_SIZE` constant)
|
|
263
|
+
|
|
264
|
+
### Access Control
|
|
265
|
+
|
|
266
|
+
The webhook proxy inherits n8n's authentication and access control mechanisms.
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## Troubleshooting
|
|
271
|
+
|
|
272
|
+
### Common Issues
|
|
273
|
+
|
|
274
|
+
#### 1. "Bucket not found" Error
|
|
275
|
+
|
|
276
|
+
**Problem:** The S3 bucket or Supabase storage bucket doesn't exist or is not accessible.
|
|
277
|
+
|
|
278
|
+
**Solution:**
|
|
279
|
+
|
|
280
|
+
- Verify bucket name is correct
|
|
281
|
+
- Check credentials have read/write access
|
|
282
|
+
- Ensure bucket is in the correct region
|
|
283
|
+
|
|
284
|
+
#### 2. "Access Denied" Error
|
|
285
|
+
|
|
286
|
+
**Problem:** Insufficient permissions.
|
|
287
|
+
|
|
288
|
+
**Solution:**
|
|
289
|
+
|
|
290
|
+
- Verify access keys are correct
|
|
291
|
+
- Check IAM policy includes `s3:PutObject`, `s3:GetObject`, `s3:DeleteObject`
|
|
292
|
+
- For Supabase, ensure API key has storage permissions
|
|
293
|
+
|
|
294
|
+
#### 3. URL Returns 404
|
|
295
|
+
|
|
296
|
+
**Problem:** File not found or URL is incorrect.
|
|
297
|
+
|
|
298
|
+
**Solution:**
|
|
299
|
+
|
|
300
|
+
- Verify the workflow is active (webhooks only work in active workflows)
|
|
301
|
+
- Check the fileKey exists in storage
|
|
302
|
+
- Ensure node name hasn't changed (URL includes node name)
|
|
303
|
+
|
|
304
|
+
#### 4. Large Files Cause Memory Issues
|
|
305
|
+
|
|
306
|
+
**Problem:** Uploading files >10MB to Supabase consumes memory.
|
|
307
|
+
|
|
308
|
+
**Solution:**
|
|
309
|
+
|
|
310
|
+
- Use S3 instead for better streaming support
|
|
311
|
+
- Reduce file size before upload
|
|
312
|
+
- Increase Node.js memory limit: `NODE_OPTIONS=--max-old-space-size=4096`
|
|
313
|
+
|
|
314
|
+
### Debug Mode
|
|
315
|
+
|
|
316
|
+
Enable debug logging in n8n:
|
|
317
|
+
|
|
318
|
+
```bash
|
|
319
|
+
export N8N_LOG_LEVEL=debug
|
|
320
|
+
npm start
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
## Development
|
|
326
|
+
|
|
327
|
+
### Project Structure
|
|
328
|
+
|
|
329
|
+
```
|
|
330
|
+
n8n-nodes-binary-to-url/
|
|
331
|
+
├── nodes/
|
|
332
|
+
│ └── BinaryBridge/
|
|
333
|
+
│ ├── BinaryBridge.node.ts # Main node implementation
|
|
334
|
+
│ └── BinaryBridge.svg # Node icon
|
|
335
|
+
├── drivers/
|
|
336
|
+
│ ├── index.ts # Driver factory
|
|
337
|
+
│ ├── S3Storage.ts # AWS S3 driver
|
|
338
|
+
│ └── SupabaseStorage.ts # Supabase driver
|
|
339
|
+
├── dist/ # Compiled output
|
|
340
|
+
├── package.json
|
|
341
|
+
├── tsconfig.json
|
|
342
|
+
└── README.md
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
### Build
|
|
346
|
+
|
|
347
|
+
```bash
|
|
348
|
+
npm install
|
|
349
|
+
npm run build
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
### Development
|
|
353
|
+
|
|
354
|
+
```bash
|
|
355
|
+
npm run dev # Watch mode
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
### Lint & Format
|
|
359
|
+
|
|
360
|
+
```bash
|
|
361
|
+
npm run lint # Check code quality
|
|
362
|
+
npm run lintfix # Auto-fix lint issues
|
|
363
|
+
npm run format # Format with Prettier
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
### Test
|
|
367
|
+
|
|
368
|
+
```bash
|
|
369
|
+
npm test
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
---
|
|
73
373
|
|
|
74
374
|
## Technical Details
|
|
75
375
|
|
|
76
|
-
- **Node Type
|
|
77
|
-
- **Version
|
|
78
|
-
- **n8n Version
|
|
79
|
-
- **Dependencies
|
|
80
|
-
-
|
|
81
|
-
-
|
|
376
|
+
- **Node Type:** Transform
|
|
377
|
+
- **Version:** 0.0.1
|
|
378
|
+
- **n8n Version:** >= 1.0.0
|
|
379
|
+
- **Dependencies:**
|
|
380
|
+
- `@aws-sdk/client-s3` - AWS S3 client
|
|
381
|
+
- `@supabase/supabase-js` - Supabase client
|
|
382
|
+
- `file-type` - MIME type detection
|
|
383
|
+
|
|
384
|
+
---
|
|
82
385
|
|
|
83
386
|
## License
|
|
84
387
|
|
|
85
|
-
MIT
|
|
388
|
+
[MIT](LICENSE)
|
|
389
|
+
|
|
390
|
+
---
|
|
86
391
|
|
|
87
392
|
## Repository
|
|
88
393
|
|
|
89
|
-
https://cnb.cool/ksxh-wwrs/n8n-nodes-binary-
|
|
394
|
+
[https://cnb.cool/ksxh-wwrs/n8n-nodes-binary-to-url](https://cnb.cool/ksxh-wwrs/n8n-nodes-binary-to-url)
|
|
395
|
+
|
|
396
|
+
---
|
|
397
|
+
|
|
398
|
+
## Contributing
|
|
399
|
+
|
|
400
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
401
|
+
|
|
402
|
+
---
|
|
403
|
+
|
|
404
|
+
## Support
|
|
405
|
+
|
|
406
|
+
- Create an issue in the GitHub repository
|
|
407
|
+
- Check the [n8n community forum](https://community.n8n.io)
|
|
408
|
+
|
|
409
|
+
---
|
|
410
|
+
|
|
411
|
+
## Changelog
|
|
412
|
+
|
|
413
|
+
### 0.0.1 (2026-01-10)
|
|
414
|
+
|
|
415
|
+
- Initial release
|
|
416
|
+
- Support for AWS S3 and S3-compatible storage
|
|
417
|
+
- Support for Supabase storage
|
|
418
|
+
- Upload and Delete operations
|
|
419
|
+
- Built-in webhook proxy
|
|
420
|
+
- Streaming support for memory efficiency
|
|
421
|
+
- MIME type validation
|
|
422
|
+
- File size limits (100MB)
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Readable } from 'stream';
|
|
2
1
|
export interface StorageConfig {
|
|
3
2
|
accessKeyId: string;
|
|
4
3
|
secretAccessKey: string;
|
|
@@ -12,16 +11,25 @@ export interface UploadResult {
|
|
|
12
11
|
contentType: string;
|
|
13
12
|
}
|
|
14
13
|
export interface DownloadResult {
|
|
15
|
-
|
|
14
|
+
data: Buffer;
|
|
16
15
|
contentType: string;
|
|
17
16
|
}
|
|
18
17
|
export declare class S3Storage {
|
|
19
|
-
private
|
|
20
|
-
private bucket;
|
|
18
|
+
private config;
|
|
21
19
|
constructor(config: StorageConfig);
|
|
22
|
-
uploadStream(
|
|
20
|
+
uploadStream(data: Buffer, contentType: string, metadata?: Record<string, string>): Promise<UploadResult>;
|
|
23
21
|
downloadStream(fileKey: string): Promise<DownloadResult>;
|
|
24
22
|
deleteFile(fileKey: string): Promise<void>;
|
|
23
|
+
private getEndpoint;
|
|
24
|
+
private generateAuthorization;
|
|
25
|
+
private getAmzDate;
|
|
26
|
+
private getDateStamp;
|
|
27
|
+
private getCanonicalHeaders;
|
|
28
|
+
private getSignedHeaders;
|
|
29
|
+
private sha256;
|
|
30
|
+
private hmac;
|
|
31
|
+
private getSigningKey;
|
|
32
|
+
private hmacSha256;
|
|
25
33
|
private generateFileKey;
|
|
26
34
|
private getExtensionFromMimeType;
|
|
27
35
|
}
|