0
# Blobs Storage
1
2
Object storage management for Netlify Blobs with CRUD operations, metadata handling, and flexible storage patterns for modern web applications.
3
4
## Capabilities
5
6
### Store Objects
7
8
Write objects to Netlify Blobs storage with support for different data sources and formats.
9
10
```typescript { .api }
11
/**
12
* Write object to Netlify Blobs store
13
* Command: netlify blobs:set <store> <key> [value...] [options]
14
* Alias: netlify blob:set
15
*/
16
interface BlobSetOptions {
17
/** Read data from filesystem path instead of command line */
18
input?: string;
19
}
20
```
21
22
**Usage Examples:**
23
24
```bash
25
# Set blob with string value
26
netlify blobs:set user-data john-123 '{"name": "John", "email": "john@example.com"}'
27
28
# Set blob with multiple value arguments (concatenated)
29
netlify blobs:set logs app-2024 "Error: " "Connection failed" " at 14:30"
30
31
# Set blob from file
32
netlify blobs:set images profile-pic --input ./photos/avatar.jpg
33
34
# Set blob with JSON data from file
35
netlify blobs:set config app-settings --input ./config/production.json
36
37
# Alternative command name
38
netlify blob:set cache user-session-123 '{"sessionId": "abc", "expires": "2024-01-01"}'
39
```
40
41
### Retrieve Objects
42
43
Read objects from Netlify Blobs storage with options for output formatting and file saving.
44
45
```typescript { .api }
46
/**
47
* Read object from Netlify Blobs store
48
* Command: netlify blobs:get <store> <key> [options]
49
* Alias: netlify blob:get
50
*/
51
interface BlobGetOptions {
52
/** Output path to save blob data instead of printing to stdout */
53
output?: string;
54
}
55
```
56
57
**Usage Examples:**
58
59
```bash
60
# Get blob content to stdout
61
netlify blobs:get user-data john-123
62
63
# Save blob to file
64
netlify blobs:get images profile-pic --output ./downloads/avatar.jpg
65
66
# Get JSON configuration
67
netlify blobs:get config app-settings --output ./local-config.json
68
69
# Alternative command name
70
netlify blob:get cache user-session-123
71
```
72
73
### List Objects
74
75
List objects in Netlify Blobs stores with filtering and formatting options.
76
77
```typescript { .api }
78
/**
79
* List objects in Netlify Blobs store
80
* Command: netlify blobs:list <store> [options]
81
* Alias: netlify blob:list
82
*/
83
interface BlobListOptions {
84
/** Treat keys with '/' as directories for hierarchical listing */
85
directories?: boolean;
86
/** Filter entries by key prefix */
87
prefix?: string;
88
/** Output as JSON instead of table format */
89
json?: boolean;
90
}
91
```
92
93
**Usage Examples:**
94
95
```bash
96
# List all objects in store
97
netlify blobs:list user-data
98
99
# List with directory structure
100
netlify blobs:list files --directories
101
102
# List with prefix filter
103
netlify blobs:list logs --prefix "app-2024"
104
105
# List as JSON
106
netlify blobs:list user-data --json
107
108
# List images with prefix
109
netlify blobs:list images --prefix "thumbnails/" --directories
110
111
# Alternative command name
112
netlify blob:list cache --json
113
```
114
115
### Delete Objects
116
117
Remove objects from Netlify Blobs storage.
118
119
```typescript { .api }
120
/**
121
* Delete object from Netlify Blobs store
122
* Command: netlify blobs:delete <store> <key>
123
* Alias: netlify blob:delete
124
*/
125
interface BlobDeleteOptions {
126
/** No additional options for delete operation */
127
}
128
```
129
130
**Usage Examples:**
131
132
```bash
133
# Delete specific object
134
netlify blobs:delete user-data john-123
135
136
# Delete image file
137
netlify blobs:delete images profile-pic-old
138
139
# Delete log entry
140
netlify blobs:delete logs app-2024-01-15
141
142
# Alternative command name
143
netlify blob:delete cache expired-session
144
```
145
146
### Blob Storage Patterns
147
148
Common patterns and use cases for Netlify Blobs storage:
149
150
```typescript { .api }
151
/**
152
* Common blob storage patterns
153
*/
154
interface BlobStoragePatterns {
155
/** User-generated content */
156
userContent: {
157
store: 'user-uploads';
158
keyPattern: 'user-{userId}/{contentType}/{timestamp}';
159
examples: [
160
'user-123/images/1640995200000',
161
'user-456/documents/1640995300000'
162
];
163
};
164
165
/** Application cache */
166
appCache: {
167
store: 'app-cache';
168
keyPattern: '{feature}/{identifier}';
169
examples: [
170
'api-responses/users-list',
171
'computed-data/stats-2024-01'
172
];
173
};
174
175
/** Configuration storage */
176
config: {
177
store: 'config';
178
keyPattern: '{environment}/{component}';
179
examples: [
180
'production/database-config',
181
'staging/feature-flags'
182
];
183
};
184
185
/** Log storage */
186
logs: {
187
store: 'logs';
188
keyPattern: '{service}/{date}/{level}';
189
examples: [
190
'api/2024-01-15/error',
191
'auth/2024-01-15/info'
192
];
193
};
194
195
/** Asset storage */
196
assets: {
197
store: 'assets';
198
keyPattern: '{type}/{size}/{hash}';
199
examples: [
200
'images/thumbnails/abc123def456',
201
'videos/compressed/789xyz012'
202
];
203
};
204
}
205
```
206
207
### Blob Data Formats
208
209
Supported data formats and content types for blob storage:
210
211
```typescript { .api }
212
/**
213
* Blob data format support
214
*/
215
interface BlobDataFormats {
216
/** Text formats */
217
text: {
218
/** Plain text */
219
plain: 'text/plain';
220
/** JSON data */
221
json: 'application/json';
222
/** XML data */
223
xml: 'application/xml';
224
/** CSV data */
225
csv: 'text/csv';
226
/** HTML content */
227
html: 'text/html';
228
/** Markdown content */
229
markdown: 'text/markdown';
230
};
231
232
/** Binary formats */
233
binary: {
234
/** Images */
235
images: ['image/jpeg', 'image/png', 'image/gif', 'image/webp', 'image/svg+xml'];
236
/** Videos */
237
videos: ['video/mp4', 'video/webm', 'video/ogg'];
238
/** Audio */
239
audio: ['audio/mp3', 'audio/wav', 'audio/ogg'];
240
/** Documents */
241
documents: ['application/pdf', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'];
242
/** Archives */
243
archives: ['application/zip', 'application/tar', 'application/gzip'];
244
};
245
246
/** Structured data */
247
structured: {
248
/** Protocol Buffers */
249
protobuf: 'application/x-protobuf';
250
/** MessagePack */
251
msgpack: 'application/x-msgpack';
252
/** BSON */
253
bson: 'application/bson';
254
};
255
}
256
```
257
258
### Blob Metadata and Properties
259
260
Blob objects include metadata and properties for management:
261
262
```typescript { .api }
263
/**
264
* Blob object metadata
265
*/
266
interface BlobMetadata {
267
/** Object key */
268
key: string;
269
/** Object size in bytes */
270
size: number;
271
/** Content type/MIME type */
272
contentType: string;
273
/** ETag for cache validation */
274
etag: string;
275
/** Last modified timestamp */
276
lastModified: Date;
277
/** Creation timestamp */
278
createdAt: Date;
279
/** Custom metadata headers */
280
metadata: Record<string, string>;
281
/** Content encoding (if compressed) */
282
contentEncoding?: 'gzip' | 'br' | 'deflate';
283
/** Cache control settings */
284
cacheControl?: string;
285
}
286
287
/**
288
* Store-level information
289
*/
290
interface StoreInfo {
291
/** Store name */
292
name: string;
293
/** Total objects in store */
294
objectCount: number;
295
/** Total storage used in bytes */
296
totalSize: number;
297
/** Store creation date */
298
createdAt: Date;
299
/** Last access date */
300
lastAccessed: Date;
301
/** Store access permissions */
302
permissions: {
303
read: boolean;
304
write: boolean;
305
delete: boolean;
306
list: boolean;
307
};
308
}
309
```
310
311
### Blob Operations Integration
312
313
Integration with other Netlify features and services:
314
315
```typescript { .api }
316
/**
317
* Integration with Netlify Functions
318
*/
319
interface FunctionsBlobIntegration {
320
/** Access blobs from functions */
321
functionAccess: {
322
/** Get blob in function */
323
getBlob: (store: string, key: string) => Promise<string | Buffer>;
324
/** Set blob from function */
325
setBlob: (store: string, key: string, data: string | Buffer) => Promise<void>;
326
/** Delete blob from function */
327
deleteBlob: (store: string, key: string) => Promise<void>;
328
/** List blobs from function */
329
listBlobs: (store: string, prefix?: string) => Promise<string[]>;
330
};
331
}
332
333
/**
334
* Integration with Edge Functions
335
*/
336
interface EdgeBlobIntegration {
337
/** Access blobs from edge functions */
338
edgeAccess: {
339
/** Cached blob access at edge */
340
getCachedBlob: (store: string, key: string) => Promise<string | null>;
341
/** Set blob with edge caching */
342
setCachedBlob: (store: string, key: string, data: string, ttl?: number) => Promise<void>;
343
};
344
}
345
346
/**
347
* Integration with build process
348
*/
349
interface BuildBlobIntegration {
350
/** Access blobs during build */
351
buildAccess: {
352
/** Generate static files from blobs */
353
generateStaticFiles: (store: string, outputDir: string) => Promise<void>;
354
/** Pre-populate blobs during build */
355
populateBlobs: (store: string, sourceDir: string) => Promise<void>;
356
};
357
}
358
```
359
360
### Blob Security and Access Control
361
362
Security features and access control for blob storage:
363
364
```typescript { .api }
365
/**
366
* Blob access control and security
367
*/
368
interface BlobSecurity {
369
/** Access control */
370
accessControl: {
371
/** Public read access */
372
publicRead: boolean;
373
/** Authenticated read access */
374
authRead: boolean;
375
/** Team member write access */
376
teamWrite: boolean;
377
/** Function-only access */
378
functionOnly: boolean;
379
};
380
381
/** Encryption settings */
382
encryption: {
383
/** Server-side encryption */
384
serverSide: boolean;
385
/** Encryption algorithm */
386
algorithm: 'AES256' | 'AES256-KMS';
387
/** Key management */
388
keyManagement: 'netlify' | 'customer';
389
};
390
391
/** Access policies */
392
policies: {
393
/** IP-based restrictions */
394
ipRestrictions?: string[];
395
/** Time-based access */
396
timeRestrictions?: {
397
start: string;
398
end: string;
399
timezone: string;
400
};
401
/** Rate limiting */
402
rateLimit?: {
403
requests: number;
404
window: number; // seconds
405
};
406
};
407
}
408
```
409
410
### Blob Performance and Caching
411
412
Performance optimization and caching strategies:
413
414
```typescript { .api }
415
/**
416
* Blob performance optimization
417
*/
418
interface BlobPerformance {
419
/** Caching strategies */
420
caching: {
421
/** CDN caching */
422
cdn: {
423
enabled: boolean;
424
ttl: number; // seconds
425
regions: string[];
426
};
427
/** Edge caching */
428
edge: {
429
enabled: boolean;
430
strategy: 'lru' | 'lfu' | 'ttl';
431
maxSize: number; // bytes
432
};
433
/** Browser caching */
434
browser: {
435
cacheControl: string;
436
expires: Date;
437
};
438
};
439
440
/** Compression */
441
compression: {
442
/** Automatic compression */
443
auto: boolean;
444
/** Compression algorithms */
445
algorithms: ['gzip', 'br', 'deflate'];
446
/** Minimum size for compression */
447
minSize: number; // bytes
448
};
449
450
/** Content delivery */
451
delivery: {
452
/** Geographic distribution */
453
regions: string[];
454
/** Bandwidth optimization */
455
bandwidthOptimization: boolean;
456
/** Concurrent transfer limits */
457
concurrencyLimits: {
458
uploads: number;
459
downloads: number;
460
};
461
};
462
}
463
```