Quick Start with ByteHide Storage
Prerequisites
Before you begin, make sure you have:
- A ByteHide account and project token
- .NET SDK installed (supports .NET Standard 2.0+, .NET Framework 4.7.2+, .NET 6+)
1. Installation
Add ByteHide Storage to your project using one of these methods:
# Using .NET CLI
dotnet add package ByteHide.Storage
# Or using Package Manager Console
Install-Package ByteHide.Storage
2. Initialize Storage
Set up the Storage SDK with your project token:
using ByteHide.Storage;
// Initialize with project token and encryption phrase
var storage = new StorageManager("<project_token>", "<encryption_phrase>");
// Or use environment variables
var storage = new StorageManager(); // Reads BYTEHIDE_STORAGE_TOKEN and BYTEHIDE_STORAGE_PHRASE
3. Upload a File
Upload your first file to ByteHide Storage:
// Upload from a file path
storage.FromFile("remote/myfile.txt", "path/to/local/myfile.txt");
// Or upload string content
storage.Set("remote/config.json", "{ \"setting\": \"value\" }");
// Or upload bytes
byte[] data = File.ReadAllBytes("myfile.dat");
storage.Set("remote/myfile.dat", data);
4. Download a File
Download or read your stored files:
// Download to local file
storage.SaveToDisk("remote/myfile.txt", "path/to/downloaded.txt");
// Or get as string
string content = storage.GetText("remote/config.json");
// Or get as bytes
byte[] data = storage.GetBytes("remote/myfile.dat");
// Or deserialize JSON directly
var config = storage.Get<MyConfig>("remote/config.json");
Next Steps
Now that you have the basics working: