gs-hf 0.4.6

Fork of hf-hub. This crates aims ease the interaction with huggingface It aims to be compatible with the huggingface_hub python package, but only implements a smaller subset of functions.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use std::os::fd::AsRawFd;
use std::path::Path;

pub(crate) fn lock<F: AsRawFd>(file: &F) -> i32 {
    unsafe { libc::flock(file.as_raw_fd(), libc::LOCK_EX | libc::LOCK_NB) }
}

pub(crate) fn unlock<F: AsRawFd>(file: &F) -> i32 {
    unsafe { libc::flock(file.as_raw_fd(), libc::LOCK_UN) }
}

pub(crate) fn symlink(rel_src: &Path, _src: &Path, dst: &Path) -> std::io::Result<()> {
    std::os::unix::fs::symlink(rel_src, dst)
}