ic-oss-can
A Rust library for implementing large file storage in Internet Computer (ICP) canisters. Part of the ic-oss.
Features
- Simple integration with the
ic_oss_fs!macro - Automatic generation of filesystem APIs in Candid format
- Using given
FS_CHUNKS_STOREstable storage - File chunk management and retrieval
- Access control with manager roles
- Compatible with
ic-oss-clifor file uploads
Quick Start
Add the following dependencies to your Cargo.toml:
[]
= "0.9"
= "0.9"
Basic Implementation
use ;
use RefCell;
use ic_oss_fs;
use ;
type Memory = ;
const FS_DATA_MEMORY_ID: MemoryId = new;
thread_local!
// need to define `FS_CHUNKS_STORE` before `ic_oss_can::ic_oss_fs!()`
ic_oss_fs!;
Available APIs
Rust Module APIs
// File Management
get_file ;
list_files ;
add_file ;
update_file ;
delete_file ;
// Chunk Operations
get_chunk ;
get_full_chunks ;
update_chunk ;
// Configuration
set_max_file_size;
set_visibility;
set_managers;
is_manager ;
with
Candid Interface
create_file : (CreateFileInput, opt blob) -> (Result_2);
delete_file : (nat32, opt blob) -> (Result_3);
list_files : (nat32, opt nat32, opt nat32, opt blob) -> (Result_4) query;
update_file_chunk : (UpdateFileChunkInput, opt blob) -> (Result_6);
update_file_info : (UpdateFileInput, opt blob) -> (Result_7);
For complete API definitions and examples, see:
License
Copyright © 2024-2025 LDC Labs.
Licensed under the MIT License. See LICENSE for details.