Skip to content

Commit a88e80d

Browse files
Document storage signed URL support in README.
Add quick-start and API reference docs for createSignedUrl in YepCodeApi and YepCodeStorage so the new storage capability is clearly discoverable. Made-with: Cursor
1 parent 6e8c1d2 commit a88e80d

1 file changed

Lines changed: 50 additions & 2 deletions

File tree

README.md

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ const processes = await api.getProcesses();
107107

108108
### 6. Storage Objects
109109

110-
You can manage files in your YepCode workspace using the `YepCodeStorage` class. This allows you to upload, list, download, and delete files easily.
110+
You can manage files in your YepCode workspace using the `YepCodeStorage` class. This allows you to upload, list, download, delete, and generate signed URLs for files easily.
111111

112112
```js
113113
const { YepCodeStorage } = require('@yepcode/run');
@@ -126,6 +126,12 @@ console.log(files);
126126
const stream = await storage.download('path/myfile.txt');
127127
stream.pipe(fs.createWriteStream('./downloaded.txt'));
128128

129+
// Create a temporary signed URL (1 hour by default)
130+
const signedUrl = await storage.createSignedUrl('path/myfile.txt', {
131+
expiresInSeconds: 300 // Optional
132+
});
133+
console.log(signedUrl.url, signedUrl.expiresAt);
134+
129135
// Delete a file
130136
await storage.delete('myfile.txt');
131137
```
@@ -392,9 +398,33 @@ interface Process {
392398
}
393399
```
394400

401+
##### `createSignedUrl(data: CreateSignedUrlInput): Promise<SignedUrl>`
402+
403+
Creates a temporary signed URL for a stored file.
404+
405+
**Parameters:**
406+
407+
- `data.path`: Storage path (filename) to generate a signed URL for
408+
- `data.expiresInSeconds`: Optional expiry in seconds
409+
410+
**Returns:** Promise<SignedUrl>
411+
412+
```typescript
413+
interface CreateSignedUrlInput {
414+
path: string;
415+
expiresInSeconds?: number;
416+
}
417+
418+
interface SignedUrl {
419+
url: string;
420+
path: string;
421+
expiresAt: string;
422+
}
423+
```
424+
395425
### YepCodeStorage
396426

397-
Manages file storage in your YepCode workspace. Allows you to upload, list, download, and delete files using the YepCode API.
427+
Manages file storage in your YepCode workspace. Allows you to upload, list, download, delete, and generate signed URLs using the YepCode API.
398428

399429
#### Constructor
400430

@@ -434,6 +464,14 @@ Deletes a file from YepCode storage.
434464
- `filename`: Name of the file to delete
435465
- **Returns:** Promise<void>
436466

467+
##### `createSignedUrl(filename: string, options?: { expiresInSeconds?: number }): Promise<SignedUrl>`
468+
469+
Creates a temporary signed URL for a file in storage.
470+
471+
- `filename`: Name of the file to generate a signed URL for
472+
- `options.expiresInSeconds`: Optional expiry in seconds
473+
- **Returns:** Promise<SignedUrl>
474+
437475
##### `StorageObject`
438476

439477
```typescript
@@ -446,6 +484,16 @@ interface StorageObject {
446484
}
447485
```
448486

487+
##### `SignedUrl`
488+
489+
```typescript
490+
interface SignedUrl {
491+
url: string;
492+
path: string;
493+
expiresAt: string;
494+
}
495+
```
496+
449497
## License
450498

451499
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

0 commit comments

Comments
 (0)