Skip to content

Files Create And Delete

This example assumes using Replicate; is in scope and apiKey contains your Replicate API key.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
using var api = GetAuthorizedClient();

var content = System.Text.Encoding.UTF8.GetBytes("Hello, Replicate!");
var fileName = "test-file.txt";

var created = await api.FilesCreateAsync(
    content: content,
    contentname: fileName,
    filename: fileName);

try
{

    var fetched = await api.FilesGetAsync(created.Id);
}
finally
{
    await api.FilesDeleteAsync(created.Id);
}